class MiniTools::Response

Attributes

args[R]
command[R]
result[R]

Public Class Methods

new(command, result, *args) click to toggle source
# File lib/mini_tools/response.rb, line 5
def initialize command, result, *args
  @command = command
  @result = result
  @args = args
end

Public Instance Methods

else(&block) click to toggle source
# File lib/mini_tools/response.rb, line 15
def else &block
  handle_response(&block) if !command.handled?
end
on(*outcome, &block) click to toggle source
# File lib/mini_tools/response.rb, line 11
def on *outcome, &block
  handle_response(&block) if outcome.include?(result)
end

Private Instance Methods

handle_response() { |*args| ... } click to toggle source
# File lib/mini_tools/response.rb, line 23
def handle_response
  command.handled = true
  yield(*args)
end