Class: EverSdk::Abi::AbiParam
- Inherits:
-
Object
- Object
- EverSdk::Abi::AbiParam
- Defined in:
- lib/ever_sdk_client/abi.rb
Instance Attribute Summary collapse
-
#components ⇒ Object
readonly
Returns the value of attribute components.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type_ ⇒ Object
readonly
Returns the value of attribute type_.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, type_:, components: []) ⇒ AbiParam
constructor
A new instance of AbiParam.
- #to_h ⇒ Object
Constructor Details
#initialize(name:, type_:, components: []) ⇒ AbiParam
Returns a new instance of AbiParam.
457 458 459 460 461 |
# File 'lib/ever_sdk_client/abi.rb', line 457 def initialize(name:, type_:, components: []) @name = name @type_ = type_ @components = components end |
Instance Attribute Details
#components ⇒ Object (readonly)
Returns the value of attribute components.
455 456 457 |
# File 'lib/ever_sdk_client/abi.rb', line 455 def components @components end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
455 456 457 |
# File 'lib/ever_sdk_client/abi.rb', line 455 def name @name end |
#type_ ⇒ Object (readonly)
Returns the value of attribute type_.
455 456 457 |
# File 'lib/ever_sdk_client/abi.rb', line 455 def type_ @type_ end |
Class Method Details
.from_json(j) ⇒ Object
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 |
# File 'lib/ever_sdk_client/abi.rb', line 475 def self.from_json(j) return nil if j.nil? comp_s = if j["components"].nil? [] else j["components"].compact.map do |x| # TODO recursive parsing of AbiParam self.from_json(x) end end self.new( name: j["name"], type_: j["type"], components: comp_s ) end |
Instance Method Details
#to_h ⇒ Object
463 464 465 466 467 468 469 470 471 472 473 |
# File 'lib/ever_sdk_client/abi.rb', line 463 def to_h cm_h_s = if !@components.nil? @components.compact.map(&:to_h) end { name: @name, type: @type_, components: cm_h_s } end |