Class: MiniTools::Response
- Inherits:
-
Object
- Object
- MiniTools::Response
- Defined in:
- lib/mini_tools/response.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #else(&block) ⇒ Object
-
#initialize(command, result, *args) ⇒ Response
constructor
A new instance of Response.
- #on(*outcome, &block) ⇒ Object
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
#args ⇒ Object (readonly)
Returns the value of attribute args.
3 4 5 |
# File 'lib/mini_tools/response.rb', line 3 def args @args end |
#result ⇒ Object (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 |