Sha256: dc89d9f4442480c9ee77f1fbcde3e46cff3d1a95b2bf74b2af11fb7347dfc238
Contents?: true
Size: 829 Bytes
Versions: 23
Compression:
Stored size: 829 Bytes
Contents
module Vedeu # A single keypress or combination of keypresses bound to a specific action. # # @api private class Key # @!attribute [r] input # @return [String|Symbol] Returns the key defined. attr_reader :input alias_method :key, :input # Returns a new instance of Vedeu::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 # 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
23 entries across 23 versions & 1 rubygems