Class: Rubybear::Type::Beneficiaries
Instance Method Summary
collapse
Methods included from Utils
#debug, #error, #extract_signatures, #hexlify, #pakArr, #pakC, #pakHash, #pakI, #pakL!, #pakS, #pakStr, #pakc, #paks, #send_log, #unhexlify, #varint, #warning
Constructor Details
Returns a new instance of Beneficiaries.
5
6
7
|
# File 'lib/rubybear/type/beneficiaries.rb', line 5
def initialize(value)
super(:beneficiaries, value)
end
|
Instance Method Details
#to_bytes ⇒ Object
9
10
11
|
# File 'lib/rubybear/type/beneficiaries.rb', line 9
def to_bytes
pakArr([]) + pakHash(@value)
end
|
#to_h ⇒ Object
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/rubybear/type/beneficiaries.rb', line 13
def to_h
v = @value.map do |b|
case b
when ::Array then {account: b.first, weight: b.last}
else; {account: b.keys.first, weight: b.values.first}
end
end
{@key => v}
end
|
#to_s ⇒ Object
24
25
26
|
# File 'lib/rubybear/type/beneficiaries.rb', line 24
def to_s
to_h.to_json
end
|