Sha256: fea2669789fcd6f13bcbfbb8a1c6e270074c458364eab2cf84ce68b0432b1bf9

Contents?: true

Size: 511 Bytes

Versions: 2

Compression:

Stored size: 511 Bytes

Contents

module GoldenFleece
  class Context
    module Export
      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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
golden_fleece-1.0.1 lib/golden_fleece/context/export.rb
golden_fleece-1.0.0 lib/golden_fleece/context/export.rb