Class: Axiom::Types::Object

Inherits:
Type
  • Object
show all
Defined in:
lib/axiom/types/object.rb

Overview

Represents an object type

Direct Known Subclasses

Boolean, Class, Collection, Date, DateTime, Hash, Numeric, String, Symbol, Time

Class Method Summary collapse

Methods inherited from Type

anonymous?, base, base?, constraint, include?, includes, new

Methods included from Options

#accept_options

Class Method Details

.finalizeClass<Axiom::Types::Object>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Finalize by setting up a primitive constraint



34
35
36
37
38
# File 'lib/axiom/types/object.rb', line 34

def self.finalize
  return self if frozen?
  inherits_from_primitive
  super
end

.infer(object) ⇒ Class<Axiom::Types::Object>?

Infer the type of the object

Examples:

Axiom::Types::Object.infer(::Object)  # => Axiom::Types::Object

Parameters:

Returns:



25
26
27
# File 'lib/axiom/types/object.rb', line 25

def self.infer(object)
  super || infer_from_primitive_class(object)
end

.inspectString

The type name and primitive

Returns:



45
46
47
# File 'lib/axiom/types/object.rb', line 45

def self.inspect
  "#{base} (#{primitive})"
end