Module: Transcriber::Resource::Embeddable::Response

Defined in:
lib/transcriber/resource/key/embeddable/response.rb

Instance Method Summary collapse

Instance Method Details

#to_resource(parent) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/transcriber/resource/key/embeddable/response.rb', line 5

def to_resource(parent)
  return {} unless visible?(parent)
  resource = nil

  if embedded = parent.__send__(name)
    resource = raw? ? embedded : resourcify(embedded)
  elsif many?
    resource = []
  end

  {name => resource}
end