Sha256: dce4c754fbe97da9e3472dc385ad519acb109a11265d4cc02485bfae95da2dbb
Contents?: true
Size: 843 Bytes
Versions: 1
Compression:
Stored size: 843 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 [Vedeu::InvalidSyntax] The required block was not given. # @return [Key] def initialize(input = nil, &block) fail Vedeu::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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.4.56 | lib/vedeu/input/key.rb |