Class: FbGraph::Collection

Inherits:
Array
  • Object
show all
Defined in:
lib/fb_graph/collection.rb

Direct Known Subclasses

Connection, Searchable::Result

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(collection = nil) ⇒ Collection

Returns a new instance of Collection.



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fb_graph/collection.rb', line 5

def initialize(collection = nil)
  collection ||= {:data => []}
  result = replace(collection[:data])
  @previous, @next = {}, {}
  if (paging = collection[:paging])
    if paging[:previous]
      @previous = fetch_params(paging[:previous])
    end
    if paging[:next]
      @next = fetch_params(paging[:next])
    end
  end
end

Instance Attribute Details

#nextObject (readonly)

Returns the value of attribute next.



3
4
5
# File 'lib/fb_graph/collection.rb', line 3

def next
  @next
end

#previousObject (readonly)

Returns the value of attribute previous.



3
4
5
# File 'lib/fb_graph/collection.rb', line 3

def previous
  @previous
end