Module: Ankit::Challenge::SlashRecognizing
- Included in:
- FailedState, MessageState, PassedStateBase, QuestionState
- Defined in:
- lib/ankit/challenge.rb
Instance Method Summary collapse
Instance Method Details
#pump_slash(command) ⇒ Object
317 318 319 320 321 322 323 324 325 326 |
# File 'lib/ankit/challenge.rb', line 317 def pump_slash(command) case command when "e", "edit" EditState.new(progress) when "z", "zero" QuestionState.new(progress) else MessageState.new(progress, "Unknown command: #{command} (Available: /edit, /zero)") end end |
#pump_slash_or(answered, &block) ⇒ Object
309 310 311 312 313 314 315 |
# File 'lib/ankit/challenge.rb', line 309 def pump_slash_or(answered, &block) if /^\/(\w+)/.match(answered) pump_slash($1) else block.call() end end |