Class: Nem::Model::MosaicDefinition
- Inherits:
-
Object
- Object
- Nem::Model::MosaicDefinition
- Extended by:
- Forwardable
- Includes:
- Nem::Mixin::Assignable
- Defined in:
- lib/nem/model/mosaic_definition.rb
Instance Attribute Summary collapse
-
#creator ⇒ Object
readonly
Returns the value of attribute creator.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#levy ⇒ Object
readonly
Returns the value of attribute levy.
-
#meta_id ⇒ Object
readonly
Returns the value of attribute meta_id.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
Class Method Summary collapse
- .new_from_mosaic_definition(hash) ⇒ Object
- .new_from_mosaic_definition_meta_data_pair(hash) ⇒ Object
Instance Method Summary collapse
Methods included from Nem::Mixin::Assignable
Instance Attribute Details
#creator ⇒ Object (readonly)
Returns the value of attribute creator.
14 15 16 |
# File 'lib/nem/model/mosaic_definition.rb', line 14 def creator @creator end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
14 15 16 |
# File 'lib/nem/model/mosaic_definition.rb', line 14 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
14 15 16 |
# File 'lib/nem/model/mosaic_definition.rb', line 14 def id @id end |
#levy ⇒ Object (readonly)
Returns the value of attribute levy.
14 15 16 |
# File 'lib/nem/model/mosaic_definition.rb', line 14 def levy @levy end |
#meta_id ⇒ Object (readonly)
Returns the value of attribute meta_id.
14 15 16 |
# File 'lib/nem/model/mosaic_definition.rb', line 14 def @meta_id end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
14 15 16 |
# File 'lib/nem/model/mosaic_definition.rb', line 14 def properties @properties end |
Class Method Details
.new_from_mosaic_definition(hash) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/nem/model/mosaic_definition.rb', line 21 def self.new_from_mosaic_definition(hash) id = MosaicId.new_from_mosaic_id(hash[:id]) props = MosaicProperties.new_from_mosaic_properties(hash[:properties]) levy = MosaicLevy.new_from_mosaic_levy(hash[:levy]) new( creator: hash[:creator], description: hash[:description], id: id, properties: props, levy: levy ) end |
.new_from_mosaic_definition_meta_data_pair(hash) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/nem/model/mosaic_definition.rb', line 34 def self.(hash) = hash[:meta] mosaic = hash[:mosaic] id = MosaicId.new_from_mosaic_id(mosaic[:id]) props = MosaicProperties.new_from_mosaic_properties(mosaic[:properties]) levy = MosaicLevy.new_from_mosaic_levy(mosaic[:levy]) new( meta_id: [:id], creator: mosaic[:creator], description: mosaic[:description], id: id, properties: props, levy: levy ) end |
Instance Method Details
#has_levy? ⇒ Boolean
50 51 52 |
# File 'lib/nem/model/mosaic_definition.rb', line 50 def has_levy? ! @levy.empty? end |
#to_hash ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/nem/model/mosaic_definition.rb', line 54 def to_hash { creator: creator, id: id.to_hash, description: description, properties: properties.to_hash, levy: levy.to_hash } end |