Ruby YAML Functions

EditRocket provides the following information on YAML functions in the Ruby source code builder.

add_builtin_type( type_tag, &transfer_proc ) - Add a transfer method for a builtin type

add_domain_type( domain, type_tag, &transfer_proc ) - Add a global handler for a YAML domain type.

add_private_type( type_re, &transfer_proc ) - Add a private document type

add_ruby_type( type_tag, &transfer_proc ) - Add a transfer method for a builtin type

detect_implicit( val ) - Detect typing of a string

dump( obj, io = nil ) - Converts obj to YAML and writes the YAML result to io.

dump_stream( *objs ) - Returns a YAML stream containing each of the items in objs, each having their own document.

each_document( io, &block ) - Calls block with each consecutive document in the YAML stream contained in io.

each_node( io, &doc_proc ) - Calls block with a tree of +YAML::BaseNodes+, one tree for each consecutive document in the YAML stream contained in io.

emitter() - Returns a new default emitter

escape( value, skip = "" ) - Escape the string, condensing common escapes

generic_parser() - Returns a new generic parser

load( io ) - Load a document from the current io stream.

load_documents( io, &doc_proc ) - Calls block with each consecutive document in the YAML stream contained in io.

load_file( filepath ) - Load a document from the file located at filepath.

load_stream( io ) - Loads all documents from the current io stream, returning a +YAML::Stream+ object containing all loaded documents.

make_stream( io ) - Class method for creating streams

object_maker( obj_class, val ) - Allocate blank object

parse( io ) - Parse the first document from the current io stream

parse_documents( io, &doc_proc ) - Calls block with a tree of +YAML::BaseNodes+, one tree for each consecutive document in the YAML stream contained in io.

parse_file( filepath ) - Parse a document from the file located at filepath.

parser() - Returns a new default parser

quick_emit( oid, opts = {}, &e ) - Allocate an Emitter if needed

read_type_class( type, obj_class ) - Method to extract colon-seperated type and class, returning the type and the constant of the class

resolver() - Returns the default resolver

tag_class( tag, cls ) - "Associates a taguri tag with a Ruby class cls. The taguri is used to give types to classes when loading YAML. Taguris are of the form:"

tagged_classes() - Returns the complete dictionary of taguris, paired with classes. The key for the dictionary is the full taguri. The value for each key is the class constant associated to that taguri.

tagurize( val ) - Convert a type_id to a taguri

transfer( type_id, obj ) - Apply a transfer method to a Ruby object

try_implicit( obj ) - Apply any implicit a node may qualify for

unescape( value ) - Unescape the condenses escapes