class Option
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
Public Class Methods
new(dialog, text, &reaction)
click to toggle source
# File lib/dialog_tui.rb, line 136 def initialize dialog, text, &reaction @dialog = dialog @text = text.to_s @reaction = reaction end
Public Instance Methods
call()
click to toggle source
# File lib/dialog_tui.rb, line 142 def call @reaction.call end
chosen?()
click to toggle source
# File lib/dialog_tui.rb, line 155 def chosen? @dialog.chosen? self end
print(printer=nil)
click to toggle source
# File lib/dialog_tui.rb, line 146 def print printer=nil # just to be here for future # refactoring if chosen? puts '=> ' + @text else puts ' ' + @text end end