class Universa::ContractState
The state of some contract reported by thee network. It is a convenience wrapper around Universa
ItemState structure.
Public Class Methods
new(universa_contract_state)
click to toggle source
# File lib/universa/client.rb, line 222 def initialize(universa_contract_state) @source = universa_contract_state end
Public Instance Methods
approved?()
click to toggle source
same as {is_approved}
# File lib/universa/client.rb, line 261 def approved? is_approved end
errors()
click to toggle source
get errors reported by the network @return [Array(Hash
)] possibly empty array of error data
# File lib/universa/client.rb, line 228 def errors @_errors ||= @source.errors || [] rescue "failed to extract errors: #$!" end
errors?()
click to toggle source
@return true if the state contain errors
# File lib/universa/client.rb, line 235 def errors? !errors.empty? end
inspect()
click to toggle source
# File lib/universa/client.rb, line 274 def inspect to_s end
is_approved()
click to toggle source
@return true if the contract state was approved
# File lib/universa/client.rb, line 251 def is_approved case state when 'APPROVED', 'LOCKED' true else false end end
is_pending()
click to toggle source
Check that state us PENDING
. Pending state is neither approved nor rejected. @return true if this state is one of the PENDING
states
# File lib/universa/client.rb, line 246 def is_pending state.start_with?('PENDING') end
pending?()
click to toggle source
same as {is_pending}
# File lib/universa/client.rb, line 266 def pending? is_pending end
state()
click to toggle source
@return ItemState structure reported by the UMI
# File lib/universa/client.rb, line 240 def state @source.state end
to_s()
click to toggle source
# File lib/universa/client.rb, line 270 def to_s "<ContractState:#{state}>" end