Class: Parameters::Types::Object Private

Inherits:
Type show all
Defined in:
lib/parameters/types/object.rb

Overview

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

Since:

  • 0.3.0

Direct Known Subclasses

Array, Class, Date, Float, Hash, Integer, Regexp, String, Symbol, Time, URI

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Type

#<, #<=, #==, #coerce, #to_ruby

Class Method Details

.===(value) ⇒ true

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.

Determines if the value is an Object.

Returns:

  • (true)

Since:

  • 0.3.0



22
23
24
# File 'lib/parameters/types/object.rb', line 22

def self.===(value)
  value.kind_of?(to_ruby)
end

.coerce(value) ⇒ value

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.

Coerces the value into an Object.

Parameters:

  • value (::Object)

    The value to coerce.

Returns:

  • (value)

    Passes through the value.

Since:

  • 0.3.0



35
36
37
# File 'lib/parameters/types/object.rb', line 35

def self.coerce(value)
  value
end

.to_rubyClass

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.

The Ruby Class the Type represents.

Returns:

  • (Class)

    The Ruby Class that matches the Types name.

Since:

  • 0.3.0



13
14
15
# File 'lib/parameters/types/object.rb', line 13

def self.to_ruby
  @ruby_class ||= ::Object.const_get(self.name.split('::').last)
end

Instance Method Details

#===(value) ⇒ true

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.

Determines if the value is an Object.

Returns:

  • (true)

Since:

  • 0.3.0



44
45
46
# File 'lib/parameters/types/object.rb', line 44

def ===(value)
  value.kind_of?(to_ruby)
end