Class: TonSdk::Abi::AbiData
- Inherits:
-
Object
- Object
- TonSdk::Abi::AbiData
- Defined in:
- lib/ton_sdk_client/abi.rb
Instance Attribute Summary collapse
-
#components ⇒ Object
readonly
Returns the value of attribute components.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#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(key:, name:, type_:, components: []) ⇒ AbiData
constructor
A new instance of AbiData.
- #to_h ⇒ Object
Constructor Details
#initialize(key:, name:, type_:, components: []) ⇒ AbiData
Returns a new instance of AbiData.
521 522 523 524 525 526 |
# File 'lib/ton_sdk_client/abi.rb', line 521 def initialize(key:, name:, type_:, components: []) @key = key @name = name @type_ = type_ @components = components end |
Instance Attribute Details
#components ⇒ Object (readonly)
Returns the value of attribute components.
519 520 521 |
# File 'lib/ton_sdk_client/abi.rb', line 519 def components @components end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
519 520 521 |
# File 'lib/ton_sdk_client/abi.rb', line 519 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
519 520 521 |
# File 'lib/ton_sdk_client/abi.rb', line 519 def name @name end |
#type_ ⇒ Object (readonly)
Returns the value of attribute type_.
519 520 521 |
# File 'lib/ton_sdk_client/abi.rb', line 519 def type_ @type_ end |
Class Method Details
.from_json(j) ⇒ Object
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 |
# File 'lib/ton_sdk_client/abi.rb', line 541 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 AbiParam.from_json(x) end end self.new( key: j["key"], name: j["name"], type_: j["type"], components: comp_s ) end |
Instance Method Details
#to_h ⇒ Object
528 529 530 531 532 533 534 535 536 537 538 539 |
# File 'lib/ton_sdk_client/abi.rb', line 528 def to_h cm_h_s = if !@components.nil? @components.compact.map(&:to_h) end { key: @key, name: @name, type: @type_, components: cm_h_s } end |