Class: ServicePattern::Response
- Inherits:
-
Object
- Object
- ServicePattern::Response
- Defined in:
- lib/service_pattern/response.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
-
#initialize(errors: [], result: nil) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(errors: [], result: nil) ⇒ Response
Returns a new instance of Response.
4 5 6 7 8 |
# File 'lib/service_pattern/response.rb', line 4 def initialize(errors: [], result: nil) @errors = errors @result = result @success = !errors || errors.empty? end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
2 3 4 |
# File 'lib/service_pattern/response.rb', line 2 def errors @errors end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
2 3 4 |
# File 'lib/service_pattern/response.rb', line 2 def result @result end |
Instance Method Details
#success? ⇒ Boolean
10 11 12 |
# File 'lib/service_pattern/response.rb', line 10 def success? @success end |