private Method

Kernel.y( object, *objects )

Prints any supplied objects out in YAML. Intended as a variation on +Kernel::p+.

S = Struct.new(:name, :state)
s = S['dave', 'TX']
y s

_produces:_

--- !ruby/struct:S
name: dave
state: TX

Source Code

# File yaml.rb, line 425
def y( object, *objects )
    objects.unshift object
    puts( if objects.length == 1
              YAML::dump( *objects )
          else
              YAML::dump_stream( *objects )
          end )
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.