Sha256: e184935cf9ada5bc3579378cf5fe067249dffe6b2adbd06a6e9a2381ceb462d6
Contents?: true
Size: 808 Bytes
Versions: 14
Compression:
Stored size: 808 Bytes
Contents
module Vedeu # A single keypress or combination of keypresses bound to a specific action. 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
14 entries across 14 versions & 1 rubygems