Class: Coercible::Coercer::TrueClass

Inherits:
Object
  • Object
show all
Defined in:
lib/coercible/coercer/true_class.rb

Overview

Coerce true values

Constant Summary

Constants inherited from Object

Object::COERCION_METHOD_REGEXP

Constants included from Options

Options::Undefined

Constants included from TypeLookup

TypeLookup::TYPE_FORMAT

Instance Attribute Summary

Attributes inherited from Object

#coercers

Instance Method Summary collapse

Methods inherited from Object

#coerced?, #initialize, #inspect, #to_array, #to_hash, #to_integer

Methods included from Options

#accept_options, #accepted_options, extended, #options

Methods included from TypeLookup

#determine_type, extended, #primitive

Constructor Details

This class inherits a constructor from Coercible::Coercer::Object

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Coercible::Coercer::Object

Instance Method Details

#to_string(value) ⇒ String

Coerce given value to String

Examples:

coercer[TrueClass].to_string(true)  # => "true"

Parameters:

Returns:



18
19
20
# File 'lib/coercible/coercer/true_class.rb', line 18

def to_string(value)
  value.to_s
end