Module: Nis::Mixin::Struct
- Included in:
- Request::Announce, Request::PrepareAnnounce, Transaction::ImportanceTransfer, Transaction::MosaicDefinitionCreation, Transaction::MosaicSupplyChange, Transaction::Multisig, Transaction::MultisigAggregateModification, Transaction::MultisigSignature, Transaction::ProvisionNamespace, Transaction::Transfer
- Defined in:
- lib/nis/mixin/struct.rb
Instance Method Summary collapse
-
#[](attr) ⇒ Any
Attribute value.
-
#to_hash ⇒ Hash
Attribute and value pairs.
-
#to_json(state = nil) ⇒ String
JSON formatted structure.
Instance Method Details
#[](attr) ⇒ Any
Returns Attribute value.
6 7 8 |
# File 'lib/nis/mixin/struct.rb', line 6 def [](attr) send(attr) end |
#to_hash ⇒ Hash
Returns Attribute and value pairs.
11 12 13 14 15 16 |
# File 'lib/nis/mixin/struct.rb', line 11 def to_hash hashed_properties = instance_variables.each_with_object({}) do |var, hash| hash[var.to_s.delete('@').to_sym] = instance_variable_get(var) end hashnize(hashed_properties) end |
#to_json(state = nil) ⇒ String
Returns JSON formatted structure.
19 20 21 |
# File 'lib/nis/mixin/struct.rb', line 19 def to_json(state = nil) to_hash.to_json(state) end |