Class: Vedeu::Input::Key Private

Inherits:
Object
  • Object
show all
Defined in:
lib/vedeu/input/key.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A single keypress or combination of keypresses bound to a specific action.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input = nil, &block) ⇒ Vedeu::Input::Key

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Vedeu::Input::Key.

Parameters:

  • input (String|Symbol) (defaults to: nil)
  • block (Proc)

Raises:



25
26
27
28
29
30
# File 'lib/vedeu/input/key.rb', line 25

def initialize(input = nil, &block)
  raise Vedeu::Error::RequiresBlock unless block_given?

  @input  = input
  @output = block
end

Instance Attribute Details

#inputString|Symbol (readonly) Also known as: key

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the key defined.

Returns:

  • (String|Symbol)

    Returns the key defined.



16
17
18
# File 'lib/vedeu/input/key.rb', line 16

def input
  @input
end

Instance Method Details

#output|Symbol Also known as: action, press

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Pressing the key will call the procedure.

Returns:

  • (|Symbol)


35
36
37
# File 'lib/vedeu/input/key.rb', line 35

def output
  @output.call
end