Class: Igniter::LedgerClient::Results::ResolveResult

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 = {}) ⇒ ResolveResult

Returns a new instance of ResolveResult.



167
168
169
170
171
172
173
# File 'lib/igniter/ledger_client/results.rb', line 167

def initialize(raw = {})
  data = normalize(raw)
  @items = normalize_items(data[:items]).freeze
  @results = Array(data[:results] || items.map { |item| item[:value] }).freeze
  @count = data.key?(:count) ? data[:count].to_i : [items.size, results.size].max
  freeze
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



165
166
167
# File 'lib/igniter/ledger_client/results.rb', line 165

def count
  @count
end

#itemsObject (readonly)

Returns the value of attribute items.



165
166
167
# File 'lib/igniter/ledger_client/results.rb', line 165

def items
  @items
end

#resultsObject (readonly)

Returns the value of attribute results.



165
166
167
# File 'lib/igniter/ledger_client/results.rb', line 165

def results
  @results
end

Instance Method Details

#to_hObject



175
176
177
# File 'lib/igniter/ledger_client/results.rb', line 175

def to_h
  { items: items, results: results, count: count }
end