class Nis::Struct::MosaicProperties

@attr [Integer] divisibility @attr [Integer] initialSupply @attr [Boolean] supplyMutable @attr [Boolean] transferable @see nemproject.github.io/#mosaicProperties

Attributes

divisibility[RW]
initialSupply[RW]
initial_supply[RW]
initial_supply=[RW]
supplyMutable[RW]
supply_mutable[RW]
supply_mutable=[RW]
transferable[RW]

Public Class Methods

build(props) click to toggle source
# 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

Public Instance Methods

supply_mutable?() click to toggle source

@return [Boolean]

# File lib/nis/struct/mosaic_properties.rb, line 31
def supply_mutable?
  @supply_mutable == 'true'
end
to_hash() click to toggle source
# 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?() click to toggle source

@return [Boolean]

# File lib/nis/struct/mosaic_properties.rb, line 36
def transferable?
  @transferable == 'true'
end