Class: Igniter::LedgerClient::Results::LineageResult
- Inherits:
-
Object
- Object
- Igniter::LedgerClient::Results::LineageResult
- Includes:
- HashAccess
- Defined in:
- lib/igniter/ledger_client/results.rb
Instance Attribute Summary collapse
-
#chain ⇒ Object
readonly
Returns the value of attribute chain.
-
#depth ⇒ Object
readonly
Returns the value of attribute depth.
-
#derived_by ⇒ Object
readonly
Returns the value of attribute derived_by.
-
#proof_hash ⇒ Object
readonly
Returns the value of attribute proof_hash.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
Instance Method Summary collapse
-
#initialize(raw = {}) ⇒ LineageResult
constructor
A new instance of LineageResult.
- #to_h ⇒ Object
Methods included from HashAccess
Constructor Details
#initialize(raw = {}) ⇒ LineageResult
Returns a new instance of LineageResult.
260 261 262 263 264 265 266 267 268 |
# File 'lib/igniter/ledger_client/results.rb', line 260 def initialize(raw = {}) data = normalize_hash(raw) @subject = normalize_hash(data[:subject]).freeze @chain = Array(data[:chain]).map { |entry| normalize_hash(entry) }.freeze @depth = data.key?(:depth) ? data[:depth].to_i : chain.size @derived_by = Array(data[:derived_by]).map { |entry| normalize_hash(entry) }.freeze @proof_hash = data[:proof_hash] freeze end |
Instance Attribute Details
#chain ⇒ Object (readonly)
Returns the value of attribute chain.
258 259 260 |
# File 'lib/igniter/ledger_client/results.rb', line 258 def chain @chain end |
#depth ⇒ Object (readonly)
Returns the value of attribute depth.
258 259 260 |
# File 'lib/igniter/ledger_client/results.rb', line 258 def depth @depth end |
#derived_by ⇒ Object (readonly)
Returns the value of attribute derived_by.
258 259 260 |
# File 'lib/igniter/ledger_client/results.rb', line 258 def derived_by @derived_by end |
#proof_hash ⇒ Object (readonly)
Returns the value of attribute proof_hash.
258 259 260 |
# File 'lib/igniter/ledger_client/results.rb', line 258 def proof_hash @proof_hash end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
258 259 260 |
# File 'lib/igniter/ledger_client/results.rb', line 258 def subject @subject end |
Instance Method Details
#to_h ⇒ Object
270 271 272 273 274 275 276 277 278 |
# File 'lib/igniter/ledger_client/results.rb', line 270 def to_h { subject: subject, chain: chain, depth: depth, derived_by: derived_by, proof_hash: proof_hash } end |