lib/moysklad/entities/attribute_value.rb in moysklad-0.3.0 vs lib/moysklad/entities/attribute_value.rb in moysklad-0.3.1
- old
+ new
@@ -1,12 +1,11 @@
-require_relative 'custom_entity'
-
module Moysklad::Entities
class AttributeValue < Virtus::Attribute
def coerce(value)
- if value.is_a? String
+ case value
+ when String, Float
value
- elsif value.is_a? ::Hash
+ when ::Hash
if value['meta']['type'] == 'customentity'
CustomEntity.new value
else
raise "Unknown meta type: #{value['meta']['type']}"
end