Class: ErpIntegration::Resources::Errors
- Inherits:
-
Object
- Object
- ErpIntegration::Resources::Errors
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/erp_integration/resources/errors.rb
Overview
The ‘ErpIntegration::Resources::Errors` expose a clean, simple API to manage and display error messages for any `ErpIntegration::Resource` instance.
Instance Method Summary collapse
-
#add(message) ⇒ String
Allows adding new error messages to the ‘ErpIntegration::Resource`.
- #each(&block) ⇒ Object
-
#initialize ⇒ Errors
constructor
A new instance of Errors.
Constructor Details
#initialize ⇒ Errors
Returns a new instance of Errors.
13 14 15 |
# File 'lib/erp_integration/resources/errors.rb', line 13 def initialize @errors = [] end |
Instance Method Details
#add(message) ⇒ String
Allows adding new error messages to the ‘ErpIntegration::Resource`.
20 21 22 23 24 25 |
# File 'lib/erp_integration/resources/errors.rb', line 20 def add() raise ErpIntegration::Error, 'Use a simple string as an error message' unless .is_a?(String) @errors << end |
#each(&block) ⇒ Object
27 28 29 |
# File 'lib/erp_integration/resources/errors.rb', line 27 def each(&block) @errors.each(&block) end |