Class: Nis::Struct::MosaicProperties

Inherits:
Object
  • Object
show all
Includes:
Util::Assignable
Defined in:
lib/nis/struct/mosaic_properties.rb

Overview

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Util::Assignable

#[], #initialize, #to_json

Instance Attribute Details

#divisibilityInteger

Returns the current value of divisibility.

Returns:

  • (Integer)

    the current value of divisibility



7
8
9
# File 'lib/nis/struct/mosaic_properties.rb', line 7

def divisibility
  @divisibility
end

#initialSupplyInteger Also known as: initial_supply

Returns the current value of initialSupply.

Returns:

  • (Integer)

    the current value of initialSupply



7
8
9
# File 'lib/nis/struct/mosaic_properties.rb', line 7

def initialSupply
  @initialSupply
end

#supplyMutableBoolean Also known as: supply_mutable

Returns the current value of supplyMutable.

Returns:

  • (Boolean)

    the current value of supplyMutable



7
8
9
# File 'lib/nis/struct/mosaic_properties.rb', line 7

def supplyMutable
  @supplyMutable
end

#transferableBoolean

Returns the current value of transferable.

Returns:

  • (Boolean)

    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

Returns:

  • (Boolean)


31
32
33
# File 'lib/nis/struct/mosaic_properties.rb', line 31

def supply_mutable?
  @supply_mutable == 'true'
end

#to_hashObject



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

Returns:

  • (Boolean)


36
37
38
# File 'lib/nis/struct/mosaic_properties.rb', line 36

def transferable?
  @transferable == 'true'
end