Sha256: c84700ff6fcc19648931ec49a53188af4e4dafd7d36ec088cdbba05871e6a5e5

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

module RTM::AR
  class Association < Reifiable
    include RTM::Association
    wrapper_cache

    parent :topic_map
    property :type, :aka => [:ty,:t], :rw => true, :type => :Topic, :wrap => true
    property_set :scope, :type => :Topic, :wrap => true
    property_set :roles, :aka => [:r, :association_roles],  :type => :AssociationRole, :wrap => true,
      :create => :role, :create_aka => [:cr, :create_association_role],
      :create_args => [ {:name => :player, :type => :Topic}, {:name => :type, :type => :Topic}]
    
    property_set :role_players, :aka => [:players, :rp, :pl], :type => :Topic, :wrap => true
    property_set :role_types, :aka => [:types, :rt], :type => :Topic, :wrap => true
    
    equality [:scope, :type, :roles]
  end

  class AssociationRole < Reifiable
    include RTM::AssociationRole
    wrapper_cache

    parent :association
    property :player, :aka => [:pl,:topic], :rw => true, :type => :Topic, :wrap => true
    property :type, :aka => [:ty,:t], :rw => true, :type => :Topic, :wrap => true

    require 'rtm/sugar/role/counterparts'
    include RTM::Sugar::Role::Counterparts
    
    equality [:type, :player, :parent]
  end
  Role = AssociationRole
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rtm-0.1.4 lib/rtm/backend/active_record/association_and_role.rb
rtm-0.1.3 lib/rtm/backend/active_record/association_and_role.rb
rtm-0.1.5 lib/rtm/backend/active_record/association_and_role.rb
rtm-0.1.6 lib/rtm/backend/active_record/association_and_role.rb