Module: GoldenFleece::Context::Export
- Included in:
- GoldenFleece::Context
- Defined in:
- lib/golden_fleece/context/export.rb
Instance Method Summary collapse
Instance Method Details
#export(record, export_attributes) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/golden_fleece/context/export.rb', line 4 def export(record, export_attributes) export_attributes = Array.wrap export_attributes schemas.reduce({}) { |memo, (attribute, schema)| if export_attributes.include? attribute memo[attribute] = schema.reduce({}) { |memo, (schema_name, schema)| memo[schema_name.to_s] = schema.value.compute(record) memo } end memo } end |