Sha256: 188c922e80f7b93365ce972b79fb99bac8b7e3a12cf2f0215712e54715b019a4
Contents?: true
Size: 640 Bytes
Versions: 4
Compression:
Stored size: 640 Bytes
Contents
module FunWithJsonApi module Attributes class FloatAttribute < FunWithJsonApi::Attribute def decode(value) Float(value.to_s) if value rescue ArgumentError => exception raise build_invalid_attribute_error(exception, value) end private def build_invalid_attribute_error(exception, value) payload = ExceptionPayload.new payload.detail = I18n.t('fun_with_json_api.exceptions.invalid_float_attribute') payload.pointer = "/data/attributes/#{name}" Exceptions::InvalidAttribute.new(exception.message + ": #{value.inspect}", payload) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems