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.7.17 lib/fb_graph/searchable/result.rb
fb_graph-2.7.16 lib/fb_graph/searchable/result.rb
fb_graph-2.7.15 lib/fb_graph/searchable/result.rb
fb_graph-2.7.14 lib/fb_graph/searchable/result.rb
fb_graph-2.7.13 lib/fb_graph/searchable/result.rb
fb_graph-2.7.12 lib/fb_graph/searchable/result.rb
fb_graph-2.7.11 lib/fb_graph/searchable/result.rb
fb_graph-2.7.10 lib/fb_graph/searchable/result.rb
fb_graph-2.7.9 lib/fb_graph/searchable/result.rb
fb_graph-2.7.8 lib/fb_graph/searchable/result.rb
fb_graph-2.7.7 lib/fb_graph/searchable/result.rb
fb_graph-2.7.6 lib/fb_graph/searchable/result.rb
fb_graph-2.7.5 lib/fb_graph/searchable/result.rb
fb_graph-2.7.4 lib/fb_graph/searchable/result.rb
fb_graph-2.7.3 lib/fb_graph/searchable/result.rb
fb_graph-2.7.2 lib/fb_graph/searchable/result.rb
fb_graph-2.7.1 lib/fb_graph/searchable/result.rb
fb_graph-2.7.0 lib/fb_graph/searchable/result.rb
fb_graph-2.6.7 lib/fb_graph/searchable/result.rb
fb_graph-2.6.6 lib/fb_graph/searchable/result.rb