Class: DialogTui::Option
- Inherits:
-
Object
- Object
- DialogTui::Option
- Defined in:
- lib/dialog_tui.rb
Overview
NOTE: not sure about perfomance implications of that chain of &block passing instead of just using variable w/o ‘&` but & looks very explicit and is not as annoying as additional parameter
Instance Method Summary collapse
- #call ⇒ Object
- #chosen? ⇒ Boolean
-
#initialize(dialog, text, &reaction) ⇒ Option
constructor
A new instance of Option.
-
#print(printer = nil) ⇒ Object
just to be here for future.
Constructor Details
Instance Method Details
#call ⇒ Object
123 124 125 |
# File 'lib/dialog_tui.rb', line 123 def call @reaction.call end |
#chosen? ⇒ Boolean
136 137 138 |
# File 'lib/dialog_tui.rb', line 136 def chosen? @dialog.chosen? self end |
#print(printer = nil) ⇒ Object
just to be here for future
127 128 129 130 131 132 133 134 |
# File 'lib/dialog_tui.rb', line 127 def print printer=nil # just to be here for future # refactoring if chosen? puts '=> ' + @text else puts ' ' + @text end end |