Sha256: 928b881d1dd059fbb8ae3ad153a2f394be7913f3dd498691cc9bd8f87c6677a8
Contents?: true
Size: 485 Bytes
Versions: 30
Compression:
Stored size: 485 Bytes
Contents
class RestModel class Embeddable module Response 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 private def resourcify(embedded) one? ? embedded.resource : embedded.map(&:resource) end end end end
Version data entries
30 entries across 30 versions & 1 rubygems