lib/vedeu/dsl/keymap.rb in vedeu-0.6.20 vs lib/vedeu/dsl/keymap.rb in vedeu-0.6.21
- old
+ new
@@ -15,11 +15,11 @@
# Define actions for keypresses for when specific interfaces are
# in focus. Unless an interface is specified, the key will be
# assumed to be global, meaning its action will happen
# regardless of the interface in focus.
#
- # Vedeu.keymap 'some_interface' do
+ # Vedeu.keymap :my_interface do
# key('s') { Vedeu.trigger(:save) }
# key('h', :left) { Vedeu.trigger(:left) }
# key('j', :down) { Vedeu.trigger(:down) }
# key('p') do
# # ... some code
@@ -27,28 +27,28 @@
# # ... some code
# end
#
# # or...
#
- # Vedeu.keys 'some_interface' do
+ # Vedeu.keys :my_interface do
# # ... some code
# end
#
# # or...
#
- # Vedeu.interface 'some_interface' do
+ # Vedeu.interface :my_interface do
# keymap do
# # ... some code
# end # or...
#
# keys do
# # ... some code
# end
# end
#
- # @param name [String] The name of the interface which this
- # keymap relates to.
+ # @param name [String|Symbol] The name of the interface which
+ # this keymap relates to.
# @param block [Proc]
# @raise [Vedeu::Error::RequiresBlock]
# @return [Vedeu::Input::Keymap]
# @todo Try to remember why we need to pre-create the keymap in
# the repository.
@@ -56,20 +56,10 @@
Vedeu::Input::Keymap.new(name: name).store
Vedeu::Input::Keymap.build(name: name, &block).store
end
- # Returns an instance of DSL::Keymap.
- #
- # @param model [Vedeu::Input::Keymap]
- # @param client [Object]
- # @return [Vedeu::DSL::Keymap]
- def initialize(model, client = nil)
- @model = model
- @client = client
- end
-
# Define keypress(es) to perform an action.
#
# @param values [Array<String>|Array<Symbol>|String|Symbol]
# The key(s) pressed. Special keys can be found in
# {Vedeu::Input::Input#specials}. When more than one key is
@@ -102,26 +92,30 @@
# Define the name of the keymap.
#
# To only allow certain keys to work with specific interfaces,
# use the same name as the interface.
#
- # When the name '_global_' is used, all keys in the keymap block
+ # When the name :_global_ is used, all keys in the keymap block
# will be available to all interfaces. Once a key has been
- # defined in the '_global_' keymap, it cannot be used for a
+ # defined in the :_global_ keymap, it cannot be used for a
# specific interface.
#
# Vedeu.keymap do
- # name 'some_interface'
+ # name :some_interface
# end
#
- # @param value [String]
+ # @param value [String|Symbol]
# @return [String]
def name(value)
model.name = value
end
alias_method :name=, :name
end # Keymap
end # DSL
+
+ # @!method keymap
+ # @see Vedeu::DSL::Keymap.keymap
+ def_delegators Vedeu::DSL::Keymap, :keymap
end # Vedeu