lib/transcriber/resource/response/embeddable.rb in transcriber-0.0.5 vs lib/transcriber/resource/response/embeddable.rb in transcriber-0.0.6

- old
+ new

@@ -6,15 +6,21 @@ return {} unless visible?(parent) resource = nil if embedded = parent.__send__(name) - resource = one? ? embedded.resource : embedded.map(&:resource) + resource = raw? ? resourcify(embedded) : embedded elsif many? resource = [] end {name => resource} + end + + private + + def resourcify(embedded) + one? ? embedded.resource : embedded.map(&:resource) end end end end end