class Parameters::Types::Class

Attributes

base_class[R]

The base-class of the Class Type

Public Class Methods

new(base_class) click to toggle source

Initializes the Class Type.

@param [Class] base_class

The base-class to wrap all values within.
# File lib/parameters/types/class.rb, line 16
def initialize(base_class)
  @base_class = base_class
end

Public Instance Methods

coerce(value) click to toggle source

Coerces a value into an instance of the Class.

@param [Object] value

The value to coerce.

@return [Object]

The instance of the Class, created using the value.
# File lib/parameters/types/class.rb, line 39
def coerce(value)
  @base_class.new(value)
end
to_ruby() click to toggle source

The Ruby Class the type represents.

@return [Class]

The base-class of the Class Type.
# File lib/parameters/types/class.rb, line 26
def to_ruby
  @base_class
end