lib/dm-serializer/to_yaml.rb in dm-serializer-0.10.2 vs lib/dm-serializer/to_yaml.rb in dm-serializer-1.0.0.rc1
- old
+ new
@@ -30,10 +30,19 @@
map.add(k.to_s,v)
end
end
end
end
+
+ module ValidationErrors
+ module ToYaml
+ def to_yaml(*args)
+ errors.to_hash.to_yaml(*args)
+ end
+ end
+ end
+
end
class Collection
def to_yaml(opts_or_emitter = {})
if !opts_or_emitter.is_a?(Hash)
@@ -43,16 +52,14 @@
to_a.collect {|x| YAML.load(x.to_yaml(opts_or_emitter)) }.to_yaml
end
end
end
- if Serialize::Support.dm_validations_loaded?
+ if Serialize.dm_validations_loaded?
- module Validate
+ module Validations
class ValidationErrors
- def to_yaml(*args)
- errors.to_hash.to_yaml(*args)
- end
+ include DataMapper::Serialize::ValidationErrors::ToYaml
end
end
end
end