Class: Nem::Model::MosaicProperties
- Inherits:
-
Object
- Object
- Nem::Model::MosaicProperties
- Includes:
- Nem::Mixin::Assignable
- Defined in:
- lib/nem/model/mosaic_properties.rb
Instance Attribute Summary collapse
-
#divisibility ⇒ Object
readonly
Returns the value of attribute divisibility.
-
#initial_supply ⇒ Object
readonly
Returns the value of attribute initial_supply.
-
#supply_mutable ⇒ Object
readonly
Returns the value of attribute supply_mutable.
-
#transferable ⇒ Object
readonly
Returns the value of attribute transferable.
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Nem::Mixin::Assignable
Instance Attribute Details
#divisibility ⇒ Object (readonly)
Returns the value of attribute divisibility.
6 7 8 |
# File 'lib/nem/model/mosaic_properties.rb', line 6 def divisibility @divisibility end |
#initial_supply ⇒ Object (readonly)
Returns the value of attribute initial_supply.
6 7 8 |
# File 'lib/nem/model/mosaic_properties.rb', line 6 def initial_supply @initial_supply end |
#supply_mutable ⇒ Object (readonly)
Returns the value of attribute supply_mutable.
6 7 8 |
# File 'lib/nem/model/mosaic_properties.rb', line 6 def supply_mutable @supply_mutable end |
#transferable ⇒ Object (readonly)
Returns the value of attribute transferable.
6 7 8 |
# File 'lib/nem/model/mosaic_properties.rb', line 6 def transferable @transferable end |
Class Method Details
.new_from_mosaic_properties(hash) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/nem/model/mosaic_properties.rb', line 11 def self.new_from_mosaic_properties(hash) props = hash.inject({}) do |memo, prop| memo[prop[:name]] = case prop[:name] when 'divisibility' then prop[:value].to_i when 'initialSupply' then prop[:value].to_i when 'supplyMutable' then prop[:value] == 'true' ? true : false when 'transferable' then prop[:value] == 'true' ? true : false else prop[:value] end memo end new( divisibility: props['divisibility'], initial_supply: props['initialSupply'], supply_mutable: props['supplyMutable'], transferable: props['transferable'] ) end |
Instance Method Details
#to_a ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/nem/model/mosaic_properties.rb', line 30 def to_a [ { name: 'divisibility', value: divisibility.to_s }, { name: 'initialSupply', value: initial_supply.to_s }, { name: 'supplyMutable', value: supply_mutable ? 'true' : 'false' }, { name: 'transferable', value: transferable ? 'true' : 'false' } ] end |
#to_hash ⇒ Object
39 40 41 |
# File 'lib/nem/model/mosaic_properties.rb', line 39 def to_hash to_a end |