lib/surrealist/value_assigner.rb
# Coerces value if type check is passed
#
# @param [Object] value the value to be checked and coerced
# @param [Struct] schema containing a single schema key and value
#
# @raise +Surrealist::InvalidTypeError+ if type-check failed at some point.
#
# @return [Object] value to be further processed
Coerces value if type check is passed
Coerces value if type check is passed
def coerce_value(value, schema)
        unless TypeHelper.valid_type?(value, schema.value)
          raise Surrealist::InvalidTypeError,
                "Wrong type for key `#{schema.key}`. Expected #{schema.value}, got #{value.class}."
        end
        TypeHelper.coerce(value, schema.value)
      end
def coerce_value ( value , schema ) unless TypeHelper . valid_type? ( value , schema . value ) raise Surrealist :: InvalidTypeError , "Wrong type for key `#{schema.key}`. Expected #{schema.value}, got #{value.class}." end TypeHelper . coerce ( value , schema . value ) end
Coerces value if type check is passed
Coerces value if type check is passed
value to be further processed
value to be further processed
Object
+Surrealist::InvalidTypeError+ if type-check failed at some point.
+ Surrealist :: InvalidTypeError + if type - check failed at some point .
value
<not_specific>
schema
<not_specific>
<not_specific>
schema containing a single schema key and value
schema containing a single schema key and value