Class: Nis::Struct::MosaicProperties
- Inherits:
-
Object
- Object
- Nis::Struct::MosaicProperties
- Includes:
- Util::Assignable
- Defined in:
- lib/nis/struct/mosaic_properties.rb
Overview
Instance Attribute Summary collapse
-
#divisibility ⇒ Integer
The current value of divisibility.
-
#initialSupply ⇒ Integer
(also: #initial_supply)
The current value of initialSupply.
-
#supplyMutable ⇒ Boolean
(also: #supply_mutable)
The current value of supplyMutable.
-
#transferable ⇒ Boolean
The current value of transferable.
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Util::Assignable
Instance Attribute Details
#divisibility ⇒ Integer
Returns the current value of divisibility.
7 8 9 |
# File 'lib/nis/struct/mosaic_properties.rb', line 7 def divisibility @divisibility end |
#initialSupply ⇒ Integer Also known as: initial_supply
Returns the current value of initialSupply.
7 8 9 |
# File 'lib/nis/struct/mosaic_properties.rb', line 7 def initialSupply @initialSupply end |
#supplyMutable ⇒ Boolean Also known as: supply_mutable
Returns the current value of supplyMutable.
7 8 9 |
# File 'lib/nis/struct/mosaic_properties.rb', line 7 def supplyMutable @supplyMutable end |
#transferable ⇒ Boolean
Returns the current value of transferable.
7 8 9 |
# File 'lib/nis/struct/mosaic_properties.rb', line 7 def transferable @transferable end |
Class Method Details
.build(props) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/nis/struct/mosaic_properties.rb', line 16 def self.build(props) attrs = props.inject({}) do |hash, prop| hash[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 hash end new(attrs) end |
Instance Method Details
#supply_mutable? ⇒ Boolean
31 32 33 |
# File 'lib/nis/struct/mosaic_properties.rb', line 31 def supply_mutable? @supply_mutable == 'true' end |
#to_hash ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/nis/struct/mosaic_properties.rb', line 40 def to_hash [{ name: 'divisibility', value: divisibility.to_s }, { name: 'initialSupply', value: initial_supply.to_s }, { name: 'supplyMutable', value: supply_mutable.to_s }, { name: 'transferable', value: transferable.to_s }] end |
#transferable? ⇒ Boolean
36 37 38 |
# File 'lib/nis/struct/mosaic_properties.rb', line 36 def transferable? @transferable == 'true' end |