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.
9 10 11 |
# File 'lib/arena/feed.rb', line 9 def limit @limit end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
9 10 11 |
# File 'lib/arena/feed.rb', line 9 def offset @offset end |
#range_end ⇒ Object (readonly)
Returns the value of attribute range_end.
9 10 11 |
# File 'lib/arena/feed.rb', line 9 def range_end @range_end end |
#range_start ⇒ Object (readonly)
Returns the value of attribute range_start.
9 10 11 |
# File 'lib/arena/feed.rb', line 9 def range_start @range_start end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
9 10 11 |
# File 'lib/arena/feed.rb', line 9 def total @total end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/arena/feed.rb', line 9 def type @type end |
Instance Method Details
#groups ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/arena/feed.rb', line 17 def groups return unless stories? groups = items.group_by do |item| target = "#{item.target.id}_" unless 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 |
#stories ⇒ Object Also known as: items
11 12 13 |
# File 'lib/arena/feed.rb', line 11 def stories @stories ||= @attrs['items'].collect { |item| Arena::Story.new(item) } if stories? end |