lib/dm-yaml-adapter/adapter.rb in dm-yaml-adapter-1.1.0 vs lib/dm-yaml-adapter/adapter.rb in dm-yaml-adapter-1.2.0.rc1
- old
+ new
@@ -36,9 +36,18 @@
records.replace(records - records_to_delete)
records_to_delete.size
end
end
+ # @api semipublic
+ def attributes_as_fields(attributes)
+ pairs = attributes.map do |property, value|
+ dumped = value.kind_of?(Module) ? value.name : property.dump(value)
+ [ property.field, dumped ]
+ end
+ Hash[pairs]
+ end
+
private
# @api semipublic
def initialize(name, options = {})
super