Exception: LedgerSync::Error::TypeError::StringFromSetError

Inherits:
LedgerSync::Error
  • Object
show all
Defined in:
lib/ledger_sync/error.rb

Instance Attribute Summary

Attributes inherited from LedgerSync::Error

#message

Instance Method Summary collapse

Constructor Details

#initialize(expected:, given:) ⇒ StringFromSetError

Returns a new instance of StringFromSetError.



48
49
50
51
52
53
54
# File 'lib/ledger_sync/error.rb', line 48

def initialize(expected:, given:)
  to_show = expected.first(10).join(', ')
  to_show += ", ... (#{expected.count - 10} more possible values)" if expected.count > 10
  super(
    message: "Unexpected value. Given #{given}. Expected: #{to_show}"
  )
end