Class: Igniter::LedgerClient::Results::FactRefResult

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

Returns a new instance of FactRefResult.



292
293
294
295
296
297
298
299
300
301
# File 'lib/igniter/ledger_client/results.rb', line 292

def initialize(raw = {})
  data = normalize_hash(raw)
  @ref = data[:ref] ? normalize_hash(data[:ref]).freeze : nil
  @found = if data.key?(:found)
             data[:found] ? true : false
           else
             !ref.nil?
           end
  freeze
end

Instance Attribute Details

#refObject (readonly)

Returns the value of attribute ref.



290
291
292
# File 'lib/igniter/ledger_client/results.rb', line 290

def ref
  @ref
end

Instance Method Details

#found?Boolean

Returns:

  • (Boolean)


303
# File 'lib/igniter/ledger_client/results.rb', line 303

def found? = @found

#to_hObject



305
306
307
# File 'lib/igniter/ledger_client/results.rb', line 305

def to_h
  { found: found?, ref: ref }
end