Module: ODDB::OddbUri

Included in:
Drugs::Dose, Util::Code, Util::Multilingual, Yaml
Defined in:
lib/oddb/export/yaml.rb

Constant Summary collapse

YAML_URI =
'!de.oddb.org,2007'

Instance Method Summary collapse

Instance Method Details

#to_yaml(opts = {}) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/oddb/export/yaml.rb', line 15

def to_yaml( opts = {} )
  YAML::quick_emit( self.object_id, opts ) { |out|
    out.map( taguri ) { |map|
      to_yaml_map(map)
    }
  }
end

#to_yaml_map(map) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/oddb/export/yaml.rb', line 22

def to_yaml_map(map)
  if(respond_to?(:oid) && id = oid)
    map.add("oid", id) 
  end
  to_yaml_properties.each { |m|
    map.add( m[1..-1], instance_variable_get( m ) )
  }
end

#to_yaml_typeObject



12
13
14
# File 'lib/oddb/export/yaml.rb', line 12

def to_yaml_type
	"#{YAML_URI}/#{self.class}"
end