Class: FbGraph::Searchable::Result

Inherits:
Collection
  • Object
show all
Defined in:
lib/fb_graph/searchable/result.rb

Instance Attribute Summary (collapse)

Attributes inherited from Collection

#cursors, #total_count, #unread_count, #updated_time

Instance Method Summary (collapse)

Constructor Details

- (Result) initialize(query, klass, options = {})

Returns a new instance of Result



6
7
8
9
10
11
12
# File 'lib/fb_graph/searchable/result.rb', line 6

def initialize(query, klass, options = {})
  @klass = klass
  @query = query
  @options = options
  @collection = options.delete(:collection) || Collection.new
  replace @collection
end

Instance Attribute Details

- (Object) collection

Returns the value of attribute collection



4
5
6
# File 'lib/fb_graph/searchable/result.rb', line 4

def collection
  @collection
end

- (Object) klass

Returns the value of attribute klass



4
5
6
# File 'lib/fb_graph/searchable/result.rb', line 4

def klass
  @klass
end

- (Object) options

Returns the value of attribute options



4
5
6
# File 'lib/fb_graph/searchable/result.rb', line 4

def options
  @options
end

- (Object) query

Returns the value of attribute query



4
5
6
# File 'lib/fb_graph/searchable/result.rb', line 4

def query
  @query
end

Instance Method Details

- (Object) next(_options_ = {})



14
15
16
17
18
19
20
# File 'lib/fb_graph/searchable/result.rb', line 14

def next(_options_ = {})
  if self.collection.next.present?
    self.klass.search(self.query, self.options.merge(_options_).merge(self.collection.next))
  else
    self.class.new(self.query, self.klass)
  end
end

- (Object) previous(_options_ = {})



22
23
24
25
26
27
28
# File 'lib/fb_graph/searchable/result.rb', line 22

def previous(_options_ = {})
  if self.collection.previous.present?
    self.klass.search(self.query, self.options.merge(_options_).merge(self.collection.previous))
  else
    self.class.new(self.query, self.klass)
  end
end