class Parameters::Types::Type

Public Class Methods

===(value) click to toggle source

Determines if the value is an instance of the Type.

@return [Boolean]

Specifies whether the value is already an instance of the Type.

@abstract

# File lib/parameters/types/type.rb, line 31
def self.===(value)
  false
end
coerce(value) click to toggle source

Coerces an Object into an instances of the Type.

@param [Object] value

The value to coerce.

@return [Object]

The coerced value.

@abstract

# File lib/parameters/types/type.rb, line 46
def self.coerce(value)
end
to_ruby() click to toggle source

The Ruby Class the type represents.

@return [Class]

A Ruby Class the Type represents.

@abstract

# File lib/parameters/types/type.rb, line 13
def self.to_ruby
end

Public Instance Methods

<(other) click to toggle source

Determines if the instance of the type is related to another Type.

@param [Type] other

The other type class.

@return [::Boolean]

Specifies whether the instance of the type inherites from another
type.

@since 0.4.0

# File lib/parameters/types/type.rb, line 77
def <(other)
  if other.kind_of?(Type)
    self.class <= other.class
  else
    self.class <= other
  end
end
<=(other) click to toggle source

Compares the type to another instance or class type.

@param [Type] other

The other instance or class type.

@return [::Boolean]

Specifies whether the instance type inherits from the other
class type, or shares the same class as the other instance type.

@since 0.4.0

# File lib/parameters/types/type.rb, line 97
def <=(other)
  (self < other) || (self == other)
end
==(other) click to toggle source

Compares the instance type to another instance type.

@param [Type] other

The other instance type.

@return [::Boolean]

Specifies that the type has the same class as the other instance
type.

@since 0.4.0

# File lib/parameters/types/type.rb, line 61
def ==(other)
  self.class == other.class
end
===(value) click to toggle source

@see ===

# File lib/parameters/types/type.rb, line 104
def ===(value)
  self.class === value
end
coerce(value) click to toggle source

@see coerce

# File lib/parameters/types/type.rb, line 111
def coerce(value)
  self.class.coerce(value)
end
to_ruby() click to toggle source

@see to_ruby

# File lib/parameters/types/type.rb, line 19
def to_ruby
  self.class.to_ruby
end