lib/daijobu/schemes/yaml.rb in sander6-daijobu-0.2.0 vs lib/daijobu/schemes/yaml.rb in sander6-daijobu-0.2.1
- old
+ new
@@ -1,14 +1,22 @@
require 'yaml'
module Daijobu
module Scheme
+
+ # Daijobu::Scheme::YAML is the serialization for YAML.
+ # Due to the strictness of the JSON module, you'll often have more luck parsing JSON containing
+ # bare objects (strings, integers, booleans, etc. without an enclosing structure) using YAML
+ # than with JSON, but YAML's a lot slower. That being said, it makes a good fallback scheme to use
+ # when JSON starts dying.
class YAML
+ # Parses the string using YAML.load.
def parse(str)
str.nil? ? nil : ::YAML.load(str)
end
+ # Unparses the object using YAML.dump.
def unparse(obj)
::YAML.dump(obj)
end
end
\ No newline at end of file