Sha256: 6fb0261b9a650104e462dae836b32d1a269822d8df0b9a209cbb01cd88a31914
Contents?: true
Size: 486 Bytes
Versions: 5
Compression:
Stored size: 486 Bytes
Contents
module JsonbAccessor module Helpers def cast_nested_field_value(value, klass, method_name) case value when klass instance = klass.new(value.attributes) when Hash instance = klass.new(value) when nil instance = klass.new else raise UnknownValue, "unable to set value '#{value}' is not a hash, `nil`, or an instance of #{klass} in #{method_name}" end instance.parent = self instance end end end
Version data entries
5 entries across 5 versions & 1 rubygems