Class: Emit::Choice

Inherits:
Object
  • Object
show all
Defined in:
lib/emit/choice.rb

Instance Method Summary collapse

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(message)
  @kwargs[:message] = message
  @block.call(*@args, **@kwargs)
end

#invoke_on_outputObject



9
10
11
# File 'lib/emit/choice.rb', line 9

def invoke_on_output
  @block.call(*@args, **@kwargs)
end