Class: FbGraph::Connection
- Inherits:
-
Collection
- Object
- Array
- Collection
- FbGraph::Connection
- Defined in:
- lib/fb_graph/connection.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
Returns the value of attribute collection.
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#options ⇒ Object
Returns the value of attribute options.
-
#owner ⇒ Object
Returns the value of attribute owner.
Attributes inherited from Collection
Instance Method Summary collapse
-
#initialize(owner, connection, options = {}) ⇒ Connection
constructor
A new instance of Connection.
- #next(_options_ = {}) ⇒ Object
- #previous(_options_ = {}) ⇒ Object
Constructor Details
#initialize(owner, connection, options = {}) ⇒ Connection
Returns a new instance of Connection.
5 6 7 8 9 10 11 |
# File 'lib/fb_graph/connection.rb', line 5 def initialize(owner, connection, = {}) @owner = owner @options = @connection = connection @collection = .delete(:collection) || FbGraph::Collection.new replace collection end |
Instance Attribute Details
#collection ⇒ Object
Returns the value of attribute collection.
3 4 5 |
# File 'lib/fb_graph/connection.rb', line 3 def collection @collection end |
#connection ⇒ Object
Returns the value of attribute connection.
3 4 5 |
# File 'lib/fb_graph/connection.rb', line 3 def connection @connection end |
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/fb_graph/connection.rb', line 3 def @options end |
#owner ⇒ Object
Returns the value of attribute owner.
3 4 5 |
# File 'lib/fb_graph/connection.rb', line 3 def owner @owner end |
Instance Method Details
#next(_options_ = {}) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/fb_graph/connection.rb', line 13 def next( = {}) if self.collection.next.present? self.owner.send(self.connection, self..merge().merge(self.collection.next)) else self.class.new(self.owner, self.connection) end end |
#previous(_options_ = {}) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/fb_graph/connection.rb', line 21 def previous( = {}) puts self..inspect if self.collection.previous.present? self.owner.send(self.connection, self..merge().merge(self.collection.previous)) else self.class.new(self.owner, self.connection) end end |