Class: LedgerSync::Ledgers::TestLedger::Util::OperationErrorParser
- Inherits:
-
ErrorParser
- Object
- ErrorParser
- LedgerSync::Ledgers::TestLedger::Util::OperationErrorParser
- Defined in:
- lib/ledger_sync/test/support/test_ledger/util/operation_error_parser.rb
Defined Under Namespace
Classes: DuplicateNameMatcher, GenericMatcher, NotFoundMatcher, ValidationError
Constant Summary collapse
- PARSERS =
! always keep GenericMatcher as last
[ DuplicateNameMatcher, NotFoundMatcher, ValidationError, GenericMatcher ].freeze
Instance Attribute Summary collapse
-
#operation ⇒ Object
readonly
Returns the value of attribute operation.
Attributes inherited from ErrorParser
Instance Method Summary collapse
-
#initialize(error:, operation: nil) ⇒ OperationErrorParser
constructor
A new instance of OperationErrorParser.
- #parse ⇒ Object
Methods inherited from ErrorParser
Constructor Details
#initialize(error:, operation: nil) ⇒ OperationErrorParser
Returns a new instance of OperationErrorParser.
78 79 80 81 |
# File 'lib/ledger_sync/test/support/test_ledger/util/operation_error_parser.rb', line 78 def initialize(error:, operation: nil) @operation = operation super(error: error) end |
Instance Attribute Details
#operation ⇒ Object (readonly)
Returns the value of attribute operation.
76 77 78 |
# File 'lib/ledger_sync/test/support/test_ledger/util/operation_error_parser.rb', line 76 def operation @operation end |
Instance Method Details
#parse ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/ledger_sync/test/support/test_ledger/util/operation_error_parser.rb', line 83 def parse PARSERS.map do |parser| matcher = parser.new(error: error) next unless matcher.match? return matcher.error_class.new( operation: operation, message: matcher., response: error ) end end |