Class: Interface::Response
- Inherits:
-
Object
- Object
- Interface::Response
- Defined in:
- lib/interface/response.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#result ⇒ Object
Returns the value of attribute result.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(result: nil, errors: []) ⇒ Response
constructor
A new instance of Response.
- #ok? ⇒ Boolean
Constructor Details
#initialize(result: nil, errors: []) ⇒ Response
Returns a new instance of Response.
13 14 15 16 17 |
# File 'lib/interface/response.rb', line 13 def initialize(result: nil, errors: []) @errors = errors @result = result @is_ok = errors.empty? end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
11 12 13 |
# File 'lib/interface/response.rb', line 11 def errors @errors end |
#result ⇒ Object
Returns the value of attribute result.
11 12 13 |
# File 'lib/interface/response.rb', line 11 def result @result end |
Class Method Details
.__error__(errors) ⇒ Object
7 8 9 |
# File 'lib/interface/response.rb', line 7 def self.__error__(errors) new(errors: Array(errors)) end |
.__ok__(result) ⇒ Object
3 4 5 |
# File 'lib/interface/response.rb', line 3 def self.__ok__(result) new(result: result) end |
Instance Method Details
#ok? ⇒ Boolean
19 20 21 |
# File 'lib/interface/response.rb', line 19 def ok? @is_ok end |