Class: MiniTools::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/mini_tools/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, result, *args) ⇒ Response

Returns a new instance of Response.



5
6
7
8
9
# File 'lib/mini_tools/response.rb', line 5

def initialize command, result, *args
  @command = command
  @result = result
  @args = args
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



3
4
5
# File 'lib/mini_tools/response.rb', line 3

def args
  @args
end

#resultObject (readonly)

Returns the value of attribute result.



3
4
5
# File 'lib/mini_tools/response.rb', line 3

def result
  @result
end

Instance Method Details

#else(&block) ⇒ Object



15
16
17
# File 'lib/mini_tools/response.rb', line 15

def else &block
  handle_response(&block) if !command.handled?
end

#on(*outcome, &block) ⇒ Object



11
12
13
# File 'lib/mini_tools/response.rb', line 11

def on *outcome, &block
  handle_response(&block) if outcome.include?(result)
end