Sha256: 68b0b5f854b47d2574b5eb79b11bd122d2878fd19dc5d55d9419c4c64d51a54b

Contents?: true

Size: 714 Bytes

Versions: 1

Compression:

Stored size: 714 Bytes

Contents

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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sander6-daijobu-0.2.1 lib/daijobu/schemes/yaml.rb