Module: RTM::AR::IO::TOYAML::Occurrence

Defined in:
lib/rtm/activerecord/io/to_yaml.rb

Instance Method Summary collapse

Instance Method Details

#to_yaml(*a) ⇒ Object



96
97
98
# File 'lib/rtm/activerecord/io/to_yaml.rb', line 96

def to_yaml(*a)
  to_yaml_hash.to_yaml(*a)
end

#to_yaml_hash(*a) ⇒ Object



86
87
88
89
90
91
92
93
94
95
# File 'lib/rtm/activerecord/io/to_yaml.rb', line 86

def to_yaml_hash(*a)
  y={}
  y['reifier'] = reifier.to_yaml_ref if reifier
  y['item_identifiers'] = item_identifiers.map{|i| i.reference} unless item_identifiers.empty?
  y['value'] = value if value
  y['datatype'] = datatype if datatype
  y['type'] = type.to_yaml_ref if type
  y['scope'] = scope.map{|i| i.to_yaml_hash} unless scope.empty?
  y
end