Sha256: 7acf091bd8fca072bfd75f97b4f2bd77d36c70968a5d490e77df82242e4ebb7d

Contents?: true

Size: 618 Bytes

Versions: 10

Compression:

Stored size: 618 Bytes

Contents

module FbGraph
  class TaggedObject < Node
    attr_accessor :name, :offset, :length

    def initialize(identifier, attributes = {})
      super
      [:name, :offset, :length].each do |key|
        self.send("#{key}=", attributes[key])
      end
    end

    def fetch_with_class_determination
      attributes = fetch_without_class_determination.raw_attributes
      klass = if attributes[:namespace]
        Application
      elsif attributes[:category]
        Page
      else
        User
      end
      klass.new attributes[:id], attributes
    end
    alias_method_chain :fetch, :class_determination
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
fb_graph-2.7.17 lib/fb_graph/tagged_object.rb
fb_graph-2.7.16 lib/fb_graph/tagged_object.rb
fb_graph-2.7.15 lib/fb_graph/tagged_object.rb
fb_graph-2.7.14 lib/fb_graph/tagged_object.rb
fb_graph-2.7.13 lib/fb_graph/tagged_object.rb
fb_graph-2.7.12 lib/fb_graph/tagged_object.rb
fb_graph-2.7.11 lib/fb_graph/tagged_object.rb
fb_graph-2.7.10 lib/fb_graph/tagged_object.rb
fb_graph-2.7.9 lib/fb_graph/tagged_object.rb
fb_graph-2.7.8 lib/fb_graph/tagged_object.rb