Sha256: 02e0e807dbc9cbb5f12e9786bfd9e5f98d6a63b300ee2320c2da1ec863c89a59

Contents?: true

Size: 463 Bytes

Versions: 8

Compression:

Stored size: 463 Bytes

Contents

module FbGraph2
  class Collection < Array
    attr_reader :previous, :next, :total_count, :unread_count, :updated_time, :cursors

    def initialize(collection)
      collection = case collection
      when Hash
        collection
      when Array
        {
          data:  collection,
          count: collection.size
        }
      else
        raise ArgumentError.new("Invalid collection")
      end
      replace Array(collection[:data])
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fb_graph2-0.1.0 lib/fb_graph2/collection.rb
fb_graph2-0.0.11 lib/fb_graph2/collection.rb
fb_graph2-0.0.10 lib/fb_graph2/collection.rb
fb_graph2-0.0.9 lib/fb_graph2/collection.rb
fb_graph2-0.0.8 lib/fb_graph2/collection.rb
fb_graph2-0.0.7 lib/fb_graph2/collection.rb
fb_graph2-0.0.6 lib/fb_graph2/collection.rb
fb_graph2-0.0.5 lib/fb_graph2/collection.rb