Class: Redd::Objects::Listing
- Inherits:
-
Array
- Object
- Array
- Redd::Objects::Listing
- Defined in:
- lib/redd/objects/listing.rb
Overview
A collection of reddit things.
Instance Attribute Summary collapse
-
#after ⇒ String
readonly
The id of the object after the listing.
-
#before ⇒ String
readonly
The id of the object before the listing.
Instance Method Summary collapse
-
#initialize(client, attributes) ⇒ Listing
constructor
A new instance of Listing.
Constructor Details
#initialize(client, attributes) ⇒ Listing
TODO:
Only call Clients::Base#object_from_body when item is being accessed.
Returns a new instance of Listing.
20 21 22 23 24 25 26 |
# File 'lib/redd/objects/listing.rb', line 20 def initialize(client, attributes) @before = attributes[:before] @after = attributes[:after] attributes[:children].each do |child| self << (client.object_from_body(child) || child) end end |
Instance Attribute Details
#after ⇒ String (readonly)
Returns The id of the object after the listing.
12 13 14 |
# File 'lib/redd/objects/listing.rb', line 12 def after @after end |
#before ⇒ String (readonly)
Returns The id of the object before the listing.
8 9 10 |
# File 'lib/redd/objects/listing.rb', line 8 def before @before end |