Sha256: cc0c9cadd141ba16ad32dc3ecbbfc6319edf2d40e0a950a2222ff2b5098c16ff

Contents?: true

Size: 893 Bytes

Versions: 141

Compression:

Stored size: 893 Bytes

Contents

module FbGraph
  module Searchable
    class Result < Collection
      attr_accessor :query, :klass, :collection, :options

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

      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

      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
    end
  end
end

Version data entries

141 entries across 141 versions & 1 rubygems

Version Path
fb_graph-2.1.2 lib/fb_graph/searchable/result.rb
fb_graph-2.1.1 lib/fb_graph/searchable/result.rb
fb_graph-2.1.0 lib/fb_graph/searchable/result.rb
fb_graph-2.1.0.alpha lib/fb_graph/searchable/result.rb
fb_graph-2.0.2 lib/fb_graph/searchable/result.rb
fb_graph-2.0.1 lib/fb_graph/searchable/result.rb
fb_graph-2.0.0 lib/fb_graph/searchable/result.rb
fb_graph-2.0.0.beta lib/fb_graph/searchable/result.rb
fb_graph-2.0.0.alpha lib/fb_graph/searchable/result.rb
fb_graph-1.9.5 lib/fb_graph/searchable/result.rb
fb_graph-1.9.4 lib/fb_graph/searchable/result.rb
fb_graph-1.9.3 lib/fb_graph/searchable/result.rb
fb_graph-1.9.2 lib/fb_graph/searchable/result.rb
fb_graph-1.9.1 lib/fb_graph/searchable/result.rb
fb_graph-1.9.0 lib/fb_graph/searchable/result.rb
fb_graph-1.8.6 lib/fb_graph/searchable/result.rb
fb_graph-1.8.5 lib/fb_graph/searchable/result.rb
fb_graph-1.8.4 lib/fb_graph/searchable/result.rb
fb_graph-1.8.3 lib/fb_graph/searchable/result.rb
fb_graph-1.8.2 lib/fb_graph/searchable/result.rb