# encoding: utf-8

module Axiom
  module Types

    # Represents an object type
    class Object < Type
      accept_options  :primitive, :coercion_method
      primitive       RUBY_VERSION >= '1.9' && defined?(::BasicObject) ? ::BasicObject : ::Object
      coercion_method :to_object

      def self.finalize
        return self if finalized?
        constraint { |object| primitive === object }
        super
      end

    end # class Object
  end # module Types
end # module Axiom

# encoding: utf-8

module Axiom
  module Types

    # Represents an object type
    class Object < Type
      accept_options  :primitive, :coercion_method
      primitive       ::Object.superclass || ::Object
      coercion_method :to_object

      def self.finalize
        return self if finalized?
        constraint { |object| primitive === object }
        super
      end

    end # class Object
  end # module Types
end # module Axiom

Refactor setting the Object primitive
Refactor setting the Object primitive

* In 1.9 ::Object.superclass will return ::BasicObject, under 1.8 it
  will return nil, so this will default to ::Object
