Module: RTM::Axes::Associations

Defined in:
lib/rtm/axes/associations.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(k) ⇒ Object



7
8
9
# File 'lib/rtm/axes/associations.rb', line 7

def self.extended(k)
  k.extend ArrayProxy
end

Instance Method Details

#players(type = :any) ⇒ Object

Returns all Role players of Roles in these Associations.

The optional identifier specifies the type of the Roles to be considered. The identifier may be a topic reference.

Multiple instances of the same Topic are possible. The result may be empty.

:call-seq:

players -> Array of Topics
players(identifier) -> Array of Topics


30
31
32
33
34
35
# File 'lib/rtm/axes/associations.rb', line 30

def players(type=:any)
  _res = self.inject([]){|all,containee| all << containee.send(:players,type)}.flatten
  ### NO UNIQUE ###
  _res = _res.extend(Topics)
  _res
end

#resultObject Also known as: tmapi



11
12
13
# File 'lib/rtm/axes/associations.rb', line 11

def result
  self.map{|i| i.construct}
end

#reverse_reifierObject

Returns the reifing Topics of these Assocations only if such Topics exist.

The result may be empty.

:call-seq:

reverse_reified -> Array of Topics


47
48
49
50
51
52
53
# File 'lib/rtm/axes/associations.rb', line 47

def reverse_reifier
  _res = self.inject([]){|all,containee| all << containee.send(:reverse_reifier)}.flatten
  _res = _res.select{|i| i}
  ### NO UNIQUE NEEDED
  _res = _res.extend(Topics)
  _res
end

#rolesObject

Returns all Topics that are types of Roles in these Associations. Multiple instances of the same Topic are possible.

The result may be empty.

:call-seq:

roles -> Array of Topics


65
66
67
68
69
70
# File 'lib/rtm/axes/associations.rb', line 65

def roles
  _res = self.inject([]){|all,containee| all << containee.send(:roles)}.flatten
  ### NO UNIQUE ###
  _res = _res.extend(Topics)
  _res
end

#scopeObject

Returns the scope of these Associations.

The result may be empty.

:call-seq:

scope -> Array of Topics


81
82
83
84
85
86
87
88
# File 'lib/rtm/axes/associations.rb', line 81

def scope
  _res = self.inject([]){|all,containee| all << containee.send(:scope)}.flatten
  ### FLAG UNIQUE ###
  _res = _res.map{|i| i.construct}.uniq.map{|i| i.axes}
  ###             ###
  _res = _res.extend(Topics)
  _res
end