Class: FbGraph::Searchable::Result
- Inherits:
-
Collection
- Object
- Array
- Collection
- FbGraph::Searchable::Result
- Defined in:
- lib/fb_graph/searchable.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
Returns the value of attribute collection.
-
#klass ⇒ Object
Returns the value of attribute klass.
-
#options ⇒ Object
Returns the value of attribute options.
-
#query ⇒ Object
Returns the value of attribute query.
Instance Method Summary collapse
-
#initialize(query, klass, options = {}) ⇒ Result
constructor
A new instance of Result.
- #next(_options_ = {}) ⇒ Object
- #previous(_options_ = {}) ⇒ Object
Constructor Details
#initialize(query, klass, options = {}) ⇒ Result
Returns a new instance of Result.
26 27 28 29 30 31 32 |
# File 'lib/fb_graph/searchable.rb', line 26 def initialize(query, klass, = {}) @klass = klass @query = query @options = @collection = .delete(:collection) || FbGraph::Collection.new replace @collection end |
Instance Attribute Details
#collection ⇒ Object
Returns the value of attribute collection.
24 25 26 |
# File 'lib/fb_graph/searchable.rb', line 24 def collection @collection end |
#klass ⇒ Object
Returns the value of attribute klass.
24 25 26 |
# File 'lib/fb_graph/searchable.rb', line 24 def klass @klass end |
#options ⇒ Object
Returns the value of attribute options.
24 25 26 |
# File 'lib/fb_graph/searchable.rb', line 24 def @options end |
#query ⇒ Object
Returns the value of attribute query.
24 25 26 |
# File 'lib/fb_graph/searchable.rb', line 24 def query @query end |
Instance Method Details
#next(_options_ = {}) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/fb_graph/searchable.rb', line 34 def next( = {}) if self.collection.next.present? self.klass.search(self.query, self..merge().merge(self.collection.next)) else self.class.new(self.query, self.klass) end end |
#previous(_options_ = {}) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/fb_graph/searchable.rb', line 42 def previous( = {}) if self.collection.previous.present? self.klassf.search(self.query, self..merge().merge(self.collection.previous)) else self.class.new(self.query, self.klass) end end |