lib/transcriber/resource/parser/property.rb in transcriber-0.0.20 vs lib/transcriber/resource/parser/property.rb in transcriber-0.0.21
- old
+ new
@@ -20,12 +20,17 @@
end
def translate_to_input(value, resource)
case translations
when nil then value
- when Hash then translations[value]
+ when Hash then translate_to_input_from_hash(value)
when Proc then resource.instance_eval(&translations)
end
+ end
+
+ def translate_to_input_from_hash(value)
+ other = value.kind_of?(Symbol) ? value.to_s : value.to_sym
+ translations.key?(value) ? translations[value] : translations.fetch(other, value)
end
def from_hash(value)
value
end