Method: Attributor::Type::ClassMethods#load
- Defined in:
- lib/attributor/type.rb
#load(value, context = Attributor::DEFAULT_ROOT_CONTEXT, **_options) ⇒ Object
Generic decoding and coercion of the attribute.
82 83 84 85 86 87 88 89 |
# File 'lib/attributor/type.rb', line 82 def load(value, context = Attributor::DEFAULT_ROOT_CONTEXT, **) return nil if value.nil? unless value.is_a?(native_type) raise Attributor::IncompatibleTypeError.new(context: context, value_type: value.class, type: self) end value end |