Class: Igniter::LedgerClient::Results::ResolveResult
- Inherits:
-
Object
- Object
- Igniter::LedgerClient::Results::ResolveResult
- Includes:
- HashAccess
- Defined in:
- lib/igniter/ledger_client/results.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
-
#initialize(raw = {}) ⇒ ResolveResult
constructor
A new instance of ResolveResult.
- #to_h ⇒ Object
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
#count ⇒ Object (readonly)
Returns the value of attribute count.
165 166 167 |
# File 'lib/igniter/ledger_client/results.rb', line 165 def count @count end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
165 166 167 |
# File 'lib/igniter/ledger_client/results.rb', line 165 def items @items end |
#results ⇒ Object (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_h ⇒ Object
175 176 177 |
# File 'lib/igniter/ledger_client/results.rb', line 175 def to_h { items: items, results: results, count: count } end |