Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more

In Files

  • yaml/stream.rb

Parent

YAML::Stream

YAML::Stream -- for emitting many documents

Attributes

documents[RW]
options[RW]

Public Class Methods

new( opts = {} ) click to toggle source
 
               # File yaml/stream.rb, line 10
def initialize( opts = {} )
        @options = opts
        @documents = []
end
            

Public Instance Methods

[]( i ) click to toggle source
 
               # File yaml/stream.rb, line 15
def []( i )
    @documents[ i ]
end
            
add( doc ) click to toggle source
 
               # File yaml/stream.rb, line 19
def add( doc )
        @documents << doc
end
            
edit( doc_num, doc ) click to toggle source
 
               # File yaml/stream.rb, line 23
def edit( doc_num, doc )
        @documents[ doc_num ] = doc
end
            
emit( io = nil ) click to toggle source
 
               # File yaml/stream.rb, line 27
    def emit( io = nil )
# opts = @options.dup
            # opts[:UseHeader] = true if @documents.length > 1
out = YAML.emitter
out.reset( io || io2 = StringIO.new )
@documents.each { |v|
    v.to_yaml( out )
}
io || ( io2.rewind; io2.read )
    end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus