Sha256: caf9c7127885b8245d49df1edfb2662536d3b99b88b6c7ee874aa0234009a668
Contents?: true
Size: 1.03 KB
Versions: 3
Compression:
Stored size: 1.03 KB
Contents
module Vedeu # A single keypress or combination of keypresses bound to a specific action. # class Key class << self # Creates a new instance of Key. # # @see Vedeu::Key#initialize def build(input = nil, &block) fail InvalidSyntax, 'block not given' unless block_given? new(input, &block) end end # Returns a new instance of Key. # # @param input [String|Symbol] # @param block [Proc] # @raise [InvalidSyntax] The required block was not given. # @return [Key] def initialize(input = nil, &block) fail InvalidSyntax, 'block not given' unless block_given? @input = input @output = block end # Returns the key defined. # # @return [String|Symbol] def input @input end alias_method :key, :input # Pressing the key will call the procedure. # # @return [|Symbol] def output @output.call end alias_method :action, :output alias_method :press, :output end # Key end # Vedeu
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.4.1 | lib/vedeu/input/key.rb |
vedeu-0.4.0 | lib/vedeu/input/key.rb |
vedeu-0.3.5 | lib/vedeu/input/key.rb |