Sha256: 65f7869137c0e2eaabe4f46e344600f5a05c1f4d5995f4933fac2b1fd198bc27
Contents?: true
Size: 812 Bytes
Versions: 7
Compression:
Stored size: 812 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
7 entries across 7 versions & 1 rubygems