Class: Mixture::Types::Object

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

Overview

An object. This adds the basic constraints all types (that inherit from Object) have; i.e., it must be an object, and it must be the type's primitive.

Direct Known Subclasses

Boolean, Class, Date, DateTime, Enumerable, Hash, Nil, Numeric, String, Symbol, Time

Class Method Summary collapse

Methods inherited from Type

anonymous?, as, constraint, constraints, inherited, inspect, mappings, matches?, options, register, to_s

Class Method Details

.inheritableArray<Class>

This, like Type.inheritable, provides a list of inheritable coercions; however, by default, if the requesting type isn't an Object, it also leaves out the Object type; this is so that types that are incompatible with another type all the way up to the Object don't end up getting coerced incorrectly.

Returns:



22
23
24
25
26
27
28
# File 'lib/mixture/types/object.rb', line 22

def self.inheritable
  if self == Object
    super
  else
    ancestors - Object.ancestors
  end
end