Class: ODDB::Substance

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

Constant Summary collapse

EXPORT_PROPERTIES =
[
	'@oid',
	'@descriptions',
	'@synonyms',
	'@swissmedic_code',
]

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



507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
# File 'ext/export/src/oddb_yaml.rb', line 507

def to_yaml( opts = {} )
	YAML::quick_emit( self.object_id, opts ) { |out|
		out.map( taguri ) { |map|
			to_yaml_properties.each { |m|
				map.add( m[1..-1], instance_variable_get( m ) )
			}
			if(@narcotic)
				map.add('narcotic', @narcotic.casrn)
			end
        if @effective_form && @effective_form != self
				map.add('effective_form', @effective_form)
        end
		}
	}
end