Sha256: eab3459da4a1d8f30d251030823aebd0b0197fedbaa465486d776414c371adc0
Contents?: true
Size: 750 Bytes
Versions: 2
Compression:
Stored size: 750 Bytes
Contents
module Vedeu # A single keypress or combination of keypresses bound to a specific action. class Key # Returns a new instance of Key. # # @param input [String|Symbol] # @param output [Proc] # @return [Key] def initialize(input, output) @input = input @output = output end # Returns the key defined. # # @return [String|Symbol] def input @input end alias_method :key, :input # The procedure to call when the key is pressed. def output @output end alias_method :action, :output # Pressing the key will call the procedure. # # @return [|Symbol] def press output.is_a?(Proc) ? output.call : :noop end end # Key end # Vedeu
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.2.12 | lib/vedeu/models/key.rb |
vedeu-0.2.11 | lib/vedeu/models/key.rb |