class DialogTui::UserAction::Action
Constants
- CHARS
any other mapping can be passed into constructor! sounds odd to pass it here, builder is a better idea, anyway strange class + builder hereā¦
Attributes
matches[R]
Public Class Methods
new(name, mapping=CHARS, &block)
click to toggle source
# File lib/dialog_tui/user_action/action.rb, line 5 def initialize name, mapping=CHARS, &block @matches = mapping.fetch name.to_sym @block = block end
Public Instance Methods
call()
click to toggle source
# File lib/dialog_tui/user_action/action.rb, line 19 def call @block.call end
match?(input)
click to toggle source
# File lib/dialog_tui/user_action/action.rb, line 13 def match? input matches == input end
Also aliased as: matches?