mirror of https://github.com/k0kubun/xremap
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
437 B
Ruby
23 lines
437 B
Ruby
8 years ago
|
module Xkremap
|
||
|
class ConfigDSL
|
||
|
# @param [Xkremap::Config] config
|
||
|
def initialize(config)
|
||
|
@config = config
|
||
|
end
|
||
|
|
||
|
def remap(from_str, options = {})
|
||
|
to_strs = Array(options.fetch(:to))
|
||
|
@config.remaps << Config::Remap.new(
|
||
|
compile_exp(from_str),
|
||
|
to_strs.map { |str| compile_exp(str) }
|
||
|
)
|
||
|
end
|
||
|
|
||
|
private
|
||
|
|
||
|
def compile_exp(str)
|
||
|
KeyExpression.compile(str)
|
||
|
end
|
||
|
end
|
||
|
end
|