lib/vedeu/models/keymap.rb in vedeu-0.2.3 vs lib/vedeu/models/keymap.rb in vedeu-0.2.4
- old
+ new
@@ -11,11 +11,13 @@
attr_reader :attributes
# Define a keymap for an interface or interfaces to perform an action when
# a key is pressed whilst an aforementioned interface is in focus.
#
- # @param attributes [Hash]
+ # @param attributes [Hash] The attributes to register the keymap with.
+ # @option attributes :interfaces []
+ # @option attributes :keys []
# @param block [Proc]
# @return [Keymap]
def self.define(attributes = {}, &block)
new(attributes).define(&block)
end
@@ -46,24 +48,25 @@
private
# The default attributes of the Keymap model.
#
- # @api private
# @return [Hash]
def defaults
{
interfaces: [], # the interface(s) which will respond to the keypress(es)
keys: [], # the keypress/action pairs for this keymap
}
end
- # @api private
+ # @param method [Symbol] The name of the method sought.
+ # @param args [Array] The arguments which the method was to be invoked with.
+ # @param block [Proc] The optional block provided to the method.
# @return []
def method_missing(method, *args, &block)
Vedeu.log("Keymap#method_missing '#{method.to_s}' (args: #{args.inspect})")
- @self_before_instance_eval.send(method, *args, &block)
+ @self_before_instance_eval.send(method, *args, &block) if @self_before_instance_eval
end
end # Keymap
end # Vedeu