class FbGraph2::Edge

Attributes

collection[RW]
edge[RW]
options[RW]
owner[RW]
params[RW]

Public Class Methods

new(owner, edge, params = {}, options = {}) click to toggle source
# File lib/fb_graph2/edge.rb, line 6
def initialize(owner, edge, params = {}, options = {})
  self.owner = owner
  self.edge = edge
  self.params = params
  self.options = options
  self.collection = options.delete(:collection) || Collection.new
  replace collection
end

Public Instance Methods

next(_options_ = {}) click to toggle source
# File lib/fb_graph2/edge.rb, line 15
def next(_options_ = {})
  if collection.next.present?
    owner.send edge, options.merge(collection.next).merge(_options_)
  elsif collection.after.present?
    owner.send edge, options.merge(after: collection.after).merge(_options_)
  else
    self.class.new owner, edge
  end
end
previous(_options_ = {}) click to toggle source
# File lib/fb_graph2/edge.rb, line 25
def previous(_options_ = {})
  if self.collection.previous.present?
    owner.send edge, options.merge(collection.previous).merge(_options_)
  elsif collection.before.present?
    owner.send edge, options.merge(before: collection.before).merge(_options_)
  else
    self.class.new owner, edge
  end
end