Class: Igniter::LedgerClient::Results::ReadResult

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

Returns a new instance of ReadResult.



99
100
101
102
103
104
# File 'lib/igniter/ledger_client/results.rb', line 99

def initialize(raw = {})
  data = normalize(raw)
  @value = data[:value]
  @found = data.key?(:found) ? boolean(data[:found]) : !value.nil?
  freeze
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



97
98
99
# File 'lib/igniter/ledger_client/results.rb', line 97

def value
  @value
end

Instance Method Details

#found?Boolean

Returns:

  • (Boolean)


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

def found? = @found

#to_hObject



108
109
110
# File 'lib/igniter/ledger_client/results.rb', line 108

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