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.6.5 lib/fb_graph/searchable/result.rb
fb_graph-2.6.4 lib/fb_graph/searchable/result.rb
fb_graph-2.6.3 lib/fb_graph/searchable/result.rb
fb_graph-2.6.2 lib/fb_graph/searchable/result.rb
fb_graph-2.6.1 lib/fb_graph/searchable/result.rb
fb_graph-2.6.0 lib/fb_graph/searchable/result.rb
fb_graph-2.5.9 lib/fb_graph/searchable/result.rb
fb_graph-2.5.8 lib/fb_graph/searchable/result.rb
fb_graph-2.5.7 lib/fb_graph/searchable/result.rb
fb_graph-2.5.6 lib/fb_graph/searchable/result.rb
fb_graph-2.5.5 lib/fb_graph/searchable/result.rb
fb_graph-2.5.4 lib/fb_graph/searchable/result.rb
fb_graph-2.5.3 lib/fb_graph/searchable/result.rb
fb_graph-2.5.2 lib/fb_graph/searchable/result.rb
fb_graph-2.5.1 lib/fb_graph/searchable/result.rb
fb_graph-2.5.0 lib/fb_graph/searchable/result.rb
fb_graph-2.4.20 lib/fb_graph/searchable/result.rb
fb_graph-2.4.19 lib/fb_graph/searchable/result.rb
fb_graph-2.4.18 lib/fb_graph/searchable/result.rb
fb_graph-2.4.17 lib/fb_graph/searchable/result.rb