Class: Ethereum::Function
- Inherits:
-
Object
- Object
- Ethereum::Function
- Defined in:
- lib/ethereum/function.rb
Instance Attribute Summary collapse
-
#constant ⇒ Object
Returns the value of attribute constant.
-
#function_string ⇒ Object
Returns the value of attribute function_string.
-
#inputs ⇒ Object
Returns the value of attribute inputs.
-
#name ⇒ Object
Returns the value of attribute name.
-
#outputs ⇒ Object
Returns the value of attribute outputs.
-
#signature ⇒ Object
Returns the value of attribute signature.
Instance Method Summary collapse
-
#initialize(data) ⇒ Function
constructor
A new instance of Function.
Constructor Details
#initialize(data) ⇒ Function
Returns a new instance of Function.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ethereum/function.rb', line 6 def initialize(data) @name = data["name"] @constant = data["constant"] @inputs = data["inputs"].collect do |input| Ethereum::FunctionInput.new(input) end @outputs = data["outputs"].collect do |output| Ethereum::FunctionOutput.new(output) end @function_string = "#{@name}(#{@inputs.collect {|x| x.type }.join(",")})" @signature = Digest::SHA3.hexdigest(@function_string, 256)[0..7] end |
Instance Attribute Details
#constant ⇒ Object
Returns the value of attribute constant.
4 5 6 |
# File 'lib/ethereum/function.rb', line 4 def constant @constant end |
#function_string ⇒ Object
Returns the value of attribute function_string.
4 5 6 |
# File 'lib/ethereum/function.rb', line 4 def function_string @function_string end |
#inputs ⇒ Object
Returns the value of attribute inputs.
4 5 6 |
# File 'lib/ethereum/function.rb', line 4 def inputs @inputs end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/ethereum/function.rb', line 4 def name @name end |
#outputs ⇒ Object
Returns the value of attribute outputs.
4 5 6 |
# File 'lib/ethereum/function.rb', line 4 def outputs @outputs end |
#signature ⇒ Object
Returns the value of attribute signature.
4 5 6 |
# File 'lib/ethereum/function.rb', line 4 def signature @signature end |