Class: Arena::Feed
Instance Attribute Summary collapse
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#range_end ⇒ Object
readonly
Returns the value of attribute range_end.
-
#range_start ⇒ Object
readonly
Returns the value of attribute range_start.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from Base
Instance Method Summary collapse
- #groups ⇒ Object
- #stories ⇒ Object (also: #items)
Methods inherited from Base
Constructor Details
This class inherits a constructor from Arena::Base
Instance Attribute Details
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
7 8 9 |
# File 'lib/arena/feed.rb', line 7 def limit @limit end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
7 8 9 |
# File 'lib/arena/feed.rb', line 7 def offset @offset end |
#range_end ⇒ Object (readonly)
Returns the value of attribute range_end.
7 8 9 |
# File 'lib/arena/feed.rb', line 7 def range_end @range_end end |
#range_start ⇒ Object (readonly)
Returns the value of attribute range_start.
7 8 9 |
# File 'lib/arena/feed.rb', line 7 def range_start @range_start end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
7 8 9 |
# File 'lib/arena/feed.rb', line 7 def total @total end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/arena/feed.rb', line 7 def type @type end |
Instance Method Details
#groups ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/arena/feed.rb', line 15 def groups if stories? groups = items.group_by do |item| target = "#{item.target.id}_" if !item.target.nil? "#{item.user.id}_#{target}#{item.action.gsub(' ', '_')}" end @groups ||= groups.collect { |key, stories| Arena::Group.new(key, stories) }. sort_by { |group| group.summary.indicative.created_at }.reverse! end end |