Class: OpenAssets::Transaction::SpendableOutput
- Inherits:
-
Object
- Object
- OpenAssets::Transaction::SpendableOutput
- Defined in:
- lib/openassets/transaction/spendable_output.rb
Overview
A transaction output with information about the asset ID and asset quantity associated to it.
Instance Attribute Summary collapse
-
#confirmations ⇒ Object
Returns the value of attribute confirmations.
-
#out_point ⇒ Object
An object that can be used to locate the output.
-
#output ⇒ Object
The actual output object.
-
#solvable ⇒ Object
Returns the value of attribute solvable.
-
#spendable ⇒ Object
Returns the value of attribute spendable.
Instance Method Summary collapse
-
#initialize(out_point, output) ⇒ SpendableOutput
constructor
A new instance of SpendableOutput.
-
#to_hash ⇒ Object
convert to hash.
Constructor Details
#initialize(out_point, output) ⇒ SpendableOutput
Returns a new instance of SpendableOutput.
18 19 20 21 22 23 24 |
# File 'lib/openassets/transaction/spendable_output.rb', line 18 def initialize(out_point, output) @out_point = out_point @output = output @confirmations = nil @solvable = nil @spendable = nil end |
Instance Attribute Details
#confirmations ⇒ Object
Returns the value of attribute confirmations.
12 13 14 |
# File 'lib/openassets/transaction/spendable_output.rb', line 12 def confirmations @confirmations end |
#out_point ⇒ Object
An object that can be used to locate the output.
8 9 10 |
# File 'lib/openassets/transaction/spendable_output.rb', line 8 def out_point @out_point end |
#output ⇒ Object
The actual output object.
10 11 12 |
# File 'lib/openassets/transaction/spendable_output.rb', line 10 def output @output end |
#solvable ⇒ Object
Returns the value of attribute solvable.
14 15 16 |
# File 'lib/openassets/transaction/spendable_output.rb', line 14 def solvable @solvable end |
#spendable ⇒ Object
Returns the value of attribute spendable.
13 14 15 |
# File 'lib/openassets/transaction/spendable_output.rb', line 13 def spendable @spendable end |
Instance Method Details
#to_hash ⇒ Object
convert to hash.
27 28 29 30 31 32 33 |
# File 'lib/openassets/transaction/spendable_output.rb', line 27 def to_hash return {} if @output.nil? h = {'txid' => @out_point.hash, 'vout' => @out_point.index, 'confirmations' => @confirmations}.merge(@output.to_hash) h['solvable'] = @solvable unless @solvable.nil? h['spendable'] = @spendable unless @spendable.nil? h end |