/**
 * @overview YAML
 * @copyright Dreamlab Onet.pl sp. z. o o 2012
 */

var libyaml = require('libyaml');

/**
 * YAML
 * @class YAML
 * @classdesc YAML
 * 
 * @requires libyaml
 * 
 * @return {YAML}
 */
var YAML = exports.YAML = {};

/**
 * Parses yaml string into json
 * @param {String} data
 * @returns {Object}
 * @static
 */
YAML.parse = function (data) {
    return libyaml.load(data);
};

/**
 * Encodes json into yaml string
 * @param {Object} obj
 * @returns {String}
 * @static
 */
YAML.stringify = function (obj) {
    return libyaml.dump(obj);
};

/**
 * Parses yaml from file into json
 * @param {String} filepath
 * @returns {Object}
 * @static
 */
YAML.parseFileSync = function (filepath) {
    return libyaml.loadFileSync(filepath);
};
