Class: ODDB::Package
- Includes:
- OddbYaml
- Defined in:
- ext/export/src/oddb_yaml.rb
Overview
< PackageCommon
Constant Summary collapse
- EXPORT_PROPERTIES =
[ '@ikscd', '@lppv', '@descr', '@ikscat', '@sl_entry', '@parts', ]
Constants included from OddbYaml
Instance Method Summary collapse
Methods included from OddbYaml
#to_yaml_properties, #to_yaml_type
Instance Method Details
#to_yaml(opts = {}) ⇒ Object
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
# File 'ext/export/src/oddb_yaml.rb', line 358 def to_yaml( opts = {} ) YAML::quick_emit( self.object_id, opts ) { |out| out.map( taguri ) { |map| if Thread.current[:export_prices] map.add('iksnr', self.iksnr) map.add('ikscd', self.ikscd) map.add('name', self.name) map.add('size', self.size) map.add('ean13', self..to_s) map.add('pharmacode', self.pharmacode) map.add('out_of_trade', !self.public?) map.add('prices', self.prices) else to_yaml_properties.each { |m| map.add( m[1..-1], instance_variable_get( m ) ) } map.add('has_generic', self.has_generic?) map.add('ean13', self..to_s) map.add('price_exfactory', self.price_exfactory.to_f) map.add('price_public', self.price_public.to_f) map.add('pharmacode', self.pharmacode) map.add('narcotics', @narcotics.collect { |narc| narc.casrn}) map.add('deductible', {'deductible_g' => 10, 'deductible_o' => 20 }[self.deductible.to_s]) end } } end |