Class: Igniter::LedgerClient::Results::CausationChainResult

Inherits:
Object
  • Object
show all
Includes:
HashAccess
Defined in:
lib/igniter/ledger_client/results.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashAccess

#[]

Constructor Details

#initialize(raw = {}) ⇒ CausationChainResult

Returns a new instance of CausationChainResult.



231
232
233
234
235
236
# File 'lib/igniter/ledger_client/results.rb', line 231

def initialize(raw = {})
  data = normalize(raw)
  @chain = Array(data[:chain]).map { |entry| normalize_hash(entry) }.freeze
  @count = data.key?(:count) ? data[:count].to_i : chain.size
  freeze
end

Instance Attribute Details

#chainObject (readonly)

Returns the value of attribute chain.



229
230
231
# File 'lib/igniter/ledger_client/results.rb', line 229

def chain
  @chain
end

#countObject (readonly)

Returns the value of attribute count.



229
230
231
# File 'lib/igniter/ledger_client/results.rb', line 229

def count
  @count
end

Instance Method Details

#to_hObject



238
239
240
# File 'lib/igniter/ledger_client/results.rb', line 238

def to_h
  { chain: chain, count: count }
end