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-1.8.1 lib/fb_graph/searchable/result.rb
fb_graph-1.8.0 lib/fb_graph/searchable/result.rb
fb_graph-1.8.0.alpha2 lib/fb_graph/searchable/result.rb
fb_graph-1.7.5 lib/fb_graph/searchable/result.rb
fb_graph-1.8.0.alpha lib/fb_graph/searchable/result.rb
fb_graph-1.7.4 lib/fb_graph/searchable/result.rb
fb_graph-1.7.3 lib/fb_graph/searchable/result.rb
fb_graph-1.7.2 lib/fb_graph/searchable/result.rb
fb_graph-1.7.1 lib/fb_graph/searchable/result.rb
fb_graph-1.7.0 lib/fb_graph/searchable/result.rb
fb_graph-1.7.0.alpha2 lib/fb_graph/searchable/result.rb
fb_graph-1.6.9 lib/fb_graph/searchable/result.rb
fb_graph-1.7.0.alpha lib/fb_graph/searchable/result.rb
fb_graph-1.6.8 lib/fb_graph/searchable/result.rb
fb_graph-1.6.7 lib/fb_graph/searchable/result.rb
fb_graph-1.6.5 lib/fb_graph/searchable/result.rb
fb_graph-1.6.4 lib/fb_graph/searchable/result.rb
fb_graph-1.6.3 lib/fb_graph/searchable/result.rb
fb_graph-1.6.2 lib/fb_graph/searchable/result.rb
fb_graph-1.6.1 lib/fb_graph/searchable/result.rb