Class: ShallowAttributes::Type::Array Abstract
- Inherits:
-
Object
- Object
- ShallowAttributes::Type::Array
- Defined in:
- lib/shallow_attributes/type/array.rb
Overview
This class is abstract.
Abstract class for typecast object to Array type.
Instance Method Summary collapse
-
#coerce(values, options = {}) ⇒ Array
Convert value to Array type.
Instance Method Details
#coerce(values, options = {}) ⇒ Array
Convert value to Array type
26 27 28 29 30 31 32 |
# File 'lib/shallow_attributes/type/array.rb', line 26 def coerce(values, = {}) unless values.is_a? ::Array raise ShallowAttributes::Type::InvalidValueError, %(Invalid value "#{values}" for type "Array") end values.map! { |value| ShallowAttributes::Type.coerce([:of], value) } end |