Module: RTM::AR::IO::TOYAML::Association

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

Instance Method Summary collapse

Instance Method Details

#to_yaml(*a) ⇒ Object

returns the YAML representation of this association



64
65
66
# File 'lib/rtm/activerecord/io/to_yaml.rb', line 64

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

#to_yaml_hash(*a) ⇒ Object



54
55
56
57
58
59
60
61
62
# File 'lib/rtm/activerecord/io/to_yaml.rb', line 54

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['type'] = type.to_yaml_ref if type
  y['scope'] = scope.map{|i| i.to_yaml_hash} unless scope.empty?
  y['roles'] = roles.map{|i| i.to_yaml_hash} unless roles.empty?
  y
end