Module: ShallowAttributes::Type
- Defined in:
- lib/shallow_attributes/type.rb,
lib/shallow_attributes/type/time.rb,
lib/shallow_attributes/type/array.rb,
lib/shallow_attributes/type/float.rb,
lib/shallow_attributes/type/string.rb,
lib/shallow_attributes/type/boolean.rb,
lib/shallow_attributes/type/integer.rb,
lib/shallow_attributes/type/date_time.rb
Overview
Namespace for standard type classes
Defined Under Namespace
Classes: Array, Boolean, DateTime, Float, Integer, InvalidValueError, String, Time
Constant Summary collapse
- DEFAULT_TYPE_OBJECTS =
Hash object with cached type objects.
{ ::Array => ShallowAttributes::Type::Array.new, ::DateTime => ShallowAttributes::Type::DateTime.new, ::Float => ShallowAttributes::Type::Float.new, ::Integer => ShallowAttributes::Type::Integer.new, ::String => ShallowAttributes::Type::String.new, ::Time => ShallowAttributes::Type::Time.new }.freeze
Class Method Summary collapse
-
.coerce(type, value, options = {}) ⇒ Object
Convert value object to specific Type class.
Class Method Details
.coerce(type, value, options = {}) ⇒ Object
Convert value object to specific Type class
56 57 58 |
# File 'lib/shallow_attributes/type.rb', line 56 def coerce(type, value, = {}) type_instance(type).coerce(value, ) end |