Class: TEALrb::ABI::ABIDescription

Inherits:
Object
  • Object
show all
Defined in:
lib/tealrb/abi.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeABIDescription

Returns a new instance of ABIDescription.



17
18
19
20
21
# File 'lib/tealrb/abi.rb', line 17

def initialize
  @name = ''
  @networks = {}
  @methods = []
end

Instance Attribute Details

#methodsObject (readonly)

Returns the value of attribute methods.



15
16
17
# File 'lib/tealrb/abi.rb', line 15

def methods
  @methods
end

#nameObject

Returns the value of attribute name.



14
15
16
# File 'lib/tealrb/abi.rb', line 14

def name
  @name
end

Instance Method Details

#add_id(network, id) ⇒ Object



32
33
34
# File 'lib/tealrb/abi.rb', line 32

def add_id(network, id)
  @networks[network] = { appID: id }
end

#add_method(name:, desc:, args:, returns:, **_kwargs) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/tealrb/abi.rb', line 23

def add_method(name:, desc:, args:, returns:, **_kwargs)
  @methods << {
    name: name,
    desc: desc,
    args: args,
    returns: { type: returns }
  }
end

#to_hObject



36
37
38
39
40
41
42
# File 'lib/tealrb/abi.rb', line 36

def to_h
  {
    'name' => @name,
    'networks' => @networks,
    'methods' => @methods
  }
end