Class: ODDB::Part

Inherits:
Object show all
Includes:
OddbYaml
Defined in:
ext/export/src/oddb_yaml.rb

Constant Summary collapse

EXPORT_PROPERTIES =
[
  '@measure', '@addition', '@commercial_form', '@composition',
]

Constants included from OddbYaml

OddbYaml::YAML_URI

Instance Method Summary collapse

Methods included from OddbYaml

#to_yaml_properties, #to_yaml_type

Instance Method Details

#to_yaml(opts = {}) ⇒ Object



391
392
393
394
395
396
397
398
399
400
401
# File 'ext/export/src/oddb_yaml.rb', line 391

def to_yaml( opts = {} )
  YAML::quick_emit( self.object_id, opts ) { |out|
    out.map( taguri ) { |map|
      map.add('count', self.count || 1)
      map.add('multi', self.multi || 1)
      to_yaml_properties.each { |m|
        map.add( m[1..-1], instance_variable_get( m ) )
      }
    }
  }
end