lib/transcriber/resource/parser/embeddable.rb in transcriber-0.0.2 vs lib/transcriber/resource/parser/embeddable.rb in transcriber-0.0.3
- old
+ new
@@ -1,11 +1,17 @@
module Transcriber
class Resource
module Parser
module Embeddable
- def parse(value)
- parsed_value = resource_class.parse(value)
+ def parse(value, resource = nil)
+ parsed_value = parse? ? resource_class.parse(value) : value
one? ? parsed_value.first : parsed_value
+ end
+
+ private
+
+ def parse?
+ ![Hash, Array].include?(resource_class)
end
end
end
end
end