Sha256: c082b877e7e45d8a8d99201b2a7661e3d72d5f233be5b0f339ac77eeaa3d2b7f

Contents?: true

Size: 515 Bytes

Versions: 4

Compression:

Stored size: 515 Bytes

Contents

module RTM::Sugar
  module Topic
    module Counterparts
      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
      def counterplayers(*args)
        return self.counterparts(*args).map{|r| r.player}
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rtm-0.1.3 lib/rtm/sugar/topic/counterparts.rb
rtm-0.1.4 lib/rtm/sugar/topic/counterparts.rb
rtm-0.1.5 lib/rtm/sugar/topic/counterparts.rb
rtm-0.1.6 lib/rtm/sugar/topic/counterparts.rb