Type:
Module

YAML Ain't Markup Language

This module provides a Ruby interface for data serialization in YAML format.

The underlying implementation is the libyaml wrapper Psych.

Usage

Working with YAML can be very simple, for example:

1
2
3
4
5
6
7
require 'yaml' # STEP ONE, REQUIRE YAML!
# Parse a YAML string
YAML.load("--- foo") #=> "foo"
 
# Emit some YAML
YAML.dump("foo")     # => "--- foo\n...\n"
{ :a => 'b'}.to_yaml  # => "---\n:a: b\n"

Security

Do not use YAML to load untrusted data. Doing so is unsafe and could allow malicious input to execute arbitrary code inside your application. Please see doc/security.rdoc for more information.

History

Syck was the original for YAML implementation in Ruby's standard library developed by why the lucky stiff.

You can still use Syck, if you prefer, for parsing and emitting YAML, but you must install the 'syck' gem now in order to use it.

In older Ruby versions, ie. <= 1.9, Syck is still provided, however it was completely removed with the release of Ruby 2.0.0.

More info

For more advanced details on the implementation see Psych, and also check out yaml.org for spec details and other helpful information.

delete_if
  • References/Ruby on Rails/Ruby/Classes/YAML/YAML::DBM

delete_if() Instance Public methods Calls the given block once for each key

2025-01-10 15:47:30
reject
  • References/Ruby on Rails/Ruby/Classes/YAML/YAML::DBM

reject() Instance Public methods Converts the contents of the database to an

2025-01-10 15:47:30
delete
  • References/Ruby on Rails/Ruby/Classes/YAML/YAML::DBM

delete( key ) Instance Public methods Deletes value from database associated

2025-01-10 15:47:30
key
  • References/Ruby on Rails/Ruby/Classes/YAML/YAML::DBM

key( keystr ) Instance Public methods

2025-01-10 15:47:30
values_at
  • References/Ruby on Rails/Ruby/Classes/YAML/YAML::DBM

values_at( *keys ) Instance Public methods Returns an array containing the values

2025-01-10 15:47:30
each_value
  • References/Ruby on Rails/Ruby/Classes/YAML/YAML::DBM

each_value() Instance Public methods Calls the given block for each value in

2025-01-10 15:47:30
select
  • References/Ruby on Rails/Ruby/Classes/YAML/YAML::DBM

select( &block )select( *keys ) Instance Public methods If a block

2025-01-10 15:47:30
has_value?
  • References/Ruby on Rails/Ruby/Classes/YAML/YAML::DBM

has_value?( val ) Instance Public methods Returns true if specified value is

2025-01-10 15:47:30
index
  • References/Ruby on Rails/Ruby/Classes/YAML/YAML::DBM

index( keystr ) Instance Public methods Deprecated, used

2025-01-10 15:47:30
new
  • References/Ruby on Rails/Ruby/Classes/YAML/YAML::Store

initialize( file_name, yaml_opts = {} ) Class Public methods Creates a new

2025-01-10 15:47:30