(10/08/29 7:24), Aaron Patterson wrote:
> On Fri, Aug 27, 2010 at 09:09:27PM +0900, Anshul Khandelwal wrote:
> There are two ways you can use Psych.  The first way is to just require
> psych and reference the Psych constant:
> 
>     require 'psych'
>     
>     Psych.load '--- hello world!'
>     Psych.dump { :goodbye => 'cruel world' }
> 
> The second way is to change the YAML engine:
> 
>     require 'yaml'
> 
>     YAML::ENGINE.yamler = 'psych'
>     YAML.load '--- hello world!'
>     YAML.dump { :goodbye => 'cruel world' }

And the third way is to require psych before yaml:

    require 'psych'
    require 'yaml'

    # p YAML::ENGINE.yamler # => 'psych'
    YAML.load '--- hello world!'
    YAML.dump { :goodbye => 'cruel world' }

-- 
Nobu Nakada