Sha256: 80f6f3eae2dbfd07b3e98112b25c41b4cc27b924ce1426ee84ccecc61af1ec2b

Contents?: true

Size: 899 Bytes

Versions: 15

Compression:

Stored size: 899 Bytes

Contents

module FbGraph
  class Connection < Collection
    attr_accessor :collection, :connection, :owner, :options

    def initialize(owner, connection, options = {})
      @owner = owner
      @options = options
      @connection = connection
      @collection = options.delete(:collection) || FbGraph::Collection.new
      replace collection
    end

    def next(_options_ = {})
      if self.collection.next.present?
        self.owner.send(self.connection, self.options.merge(_options_).merge(self.collection.next))
      else
        self.class.new(self.owner, self.connection)
      end
    end

    def previous(_options_ = {})
      puts self.options.inspect
      if self.collection.previous.present?
        self.owner.send(self.connection, self.options.merge(_options_).merge(self.collection.previous))
      else
        self.class.new(self.owner, self.connection)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
fb_graph-1.0.7 lib/fb_graph/connection.rb
fb_graph-1.0.6 lib/fb_graph/connection.rb
fb_graph-1.0.5 lib/fb_graph/connection.rb
palidanx-fb_graph-1.0.4 lib/fb_graph/connection.rb
fb_graph-1.0.4 lib/fb_graph/connection.rb
fb_graph-1.0.3 lib/fb_graph/connection.rb
fb_graph-1.0.2 lib/fb_graph/connection.rb
fb_graph-1.0.1 lib/fb_graph/connection.rb
fb_graph-1.0.0 lib/fb_graph/connection.rb
fb_graph-0.8.0 lib/fb_graph/connection.rb
fb_graph-0.7.3 lib/fb_graph/connection.rb
fb_graph-0.7.2 lib/fb_graph/connection.rb
fb_graph-0.7.1 lib/fb_graph/connection.rb
fb_graph-0.7.0 lib/fb_graph/connection.rb
fb_graph-0.6.0 lib/fb_graph/connection.rb