Sha256: f1009e9bcc1b415a25f4e420ad19fa42709f5107eba3b499cb19fb87e37f5c04
Contents?: true
Size: 921 Bytes
Versions: 6
Compression:
Stored size: 921 Bytes
Contents
# frozen_string_literal: true module Vedeu module Input # 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::Input::Key. # # @param input [String|Symbol] # @param block [Proc] # @macro raise_requires_block # @return [Vedeu::Input::Key] def initialize(input = nil, &block) fail Vedeu::Error::RequiresBlock 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 # Input end # Vedeu
Version data entries
6 entries across 6 versions & 1 rubygems