Class: TopicParticipantGroupsSummary
- Inherits:
-
Object
- Object
- TopicParticipantGroupsSummary
- Defined in:
- app/models/topic_participant_groups_summary.rb
Overview
This is used on a topic page
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#topic ⇒ Object
readonly
Returns the value of attribute topic.
Instance Method Summary collapse
- #group_ids ⇒ Object
- #group_lookup ⇒ Object
- #group_participants ⇒ Object
-
#initialize(topic, options = {}) ⇒ TopicParticipantGroupsSummary
constructor
A new instance of TopicParticipantGroupsSummary.
- #summary ⇒ Object
Constructor Details
#initialize(topic, options = {}) ⇒ TopicParticipantGroupsSummary
Returns a new instance of TopicParticipantGroupsSummary.
7 8 9 10 11 |
# File 'app/models/topic_participant_groups_summary.rb', line 7 def initialize(topic, = {}) @topic = topic @options = @group = [:group] end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'app/models/topic_participant_groups_summary.rb', line 5 def @options end |
#topic ⇒ Object (readonly)
Returns the value of attribute topic.
5 6 7 |
# File 'app/models/topic_participant_groups_summary.rb', line 5 def topic @topic end |
Instance Method Details
#group_ids ⇒ Object
22 23 24 25 26 |
# File 'app/models/topic_participant_groups_summary.rb', line 22 def group_ids ids = topic.allowed_group_ids ids = ids - [@group.id] if @group.present? ids end |
#group_lookup ⇒ Object
28 29 30 |
# File 'app/models/topic_participant_groups_summary.rb', line 28 def group_lookup @group_lookup ||= [:group_lookup] || GroupLookup.new(group_ids) end |
#group_participants ⇒ Object
17 18 19 20 |
# File 'app/models/topic_participant_groups_summary.rb', line 17 def group_participants return [] if group_ids.blank? group_ids.map { |id| group_lookup[id] } end |
#summary ⇒ Object
13 14 15 |
# File 'app/models/topic_participant_groups_summary.rb', line 13 def summary group_participants.compact end |