Class: Emit::Choice
- Inherits:
-
Object
- Object
- Emit::Choice
- Defined in:
- lib/emit/choice.rb
Instance Method Summary collapse
-
#initialize(*args, **kwargs, &block) ⇒ Choice
constructor
A new instance of Choice.
- #invoke_on_input(message) ⇒ Object
- #invoke_on_output ⇒ Object
Constructor Details
#initialize(*args, **kwargs, &block) ⇒ Choice
Returns a new instance of Choice.
3 4 5 6 7 |
# File 'lib/emit/choice.rb', line 3 def initialize(*args, **kwargs, &block) @block = block @args = args @kwargs = kwargs end |
Instance Method Details
#invoke_on_input(message) ⇒ Object
13 14 15 16 |
# File 'lib/emit/choice.rb', line 13 def invoke_on_input() @kwargs[:message] = @block.call(*@args, **@kwargs) end |
#invoke_on_output ⇒ Object
9 10 11 |
# File 'lib/emit/choice.rb', line 9 def invoke_on_output @block.call(*@args, **@kwargs) end |