Class: TezosClient::Tools::HashToMicheline::Pair
- Inherits:
-
Base
- Object
- Base
- TezosClient::Tools::HashToMicheline::Pair
show all
- Defined in:
- lib/tezos_client/tools/hash_to_micheline/pair.rb
Instance Attribute Summary
Attributes inherited from Base
#data, #type
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #value
Instance Method Details
#data_0 ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/tezos_client/tools/hash_to_micheline/pair.rb', line 23
def data_0
if data.is_a? ::Array
data[0]
else
data
end
end
|
#data_1 ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/tezos_client/tools/hash_to_micheline/pair.rb', line 31
def data_1
if data.is_a? ::Array
if data.size > 2
data.drop(1)
else
data[1]
end
else
data
end
end
|
#encode ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/tezos_client/tools/hash_to_micheline/pair.rb', line 7
def encode
{
prim: "Pair",
args: [
TezosClient::Tools::HashToMicheline::Base.new(
data: data_0,
type: type[:args][0]
).value,
TezosClient::Tools::HashToMicheline::Base.new(
data: data_1,
type: type[:args][1]
).value
]
}
end
|