Module: RTM::AR::Sugar::Topic::Counterparts
- Included in:
- Topic
- Defined in:
- lib/rtm/activerecord/sugar/topic/counterparts.rb
Instance Method Summary collapse
Instance Method Details
#counterparts(filter = {}) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/rtm/activerecord/sugar/topic/counterparts.rb', line 7 def counterparts(filter={}) self.roles. select{|r| filter[:rtype] ? r.type == self.topic_map.get(filter[:rtype]) : true}. select{|r| filter[:atype] ? r.parent.type == self.topic_map.get(filter[:atype]) : true}. inject([]){|all,r| all+=r.counterparts(filter)} end |
#counterplayers(*args) ⇒ Object
13 14 15 |
# File 'lib/rtm/activerecord/sugar/topic/counterparts.rb', line 13 def counterplayers(*args) return self.counterparts(*args).map{|r| r.player} end |