Module: LedgerSync::Error::HelpersMixin::ClassMethods
- Defined in:
- lib/ledger_sync/error.rb
Instance Method Summary collapse
Instance Method Details
#raise_if_unexpected_class(expected:, given:) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ledger_sync/error.rb', line 7 def raise_if_unexpected_class(expected:, given:) expected = Array(expected) expected = expected.map { |e| (e.is_a?(Class) ? e : e.class) } given = given.class unless given.is_a?(Class) return if expected.any? { |c| given <= c } raise UnexpectedClassError.new( expected: expected, given: given ) end |