Class: JvYAML::Stream
Overview
JvYAML::Stream – for emitting many documents
Instance Attribute Summary collapse
-
#documents ⇒ Object
Returns the value of attribute documents.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #[](i) ⇒ Object
- #add(doc) ⇒ Object
- #each(&block) ⇒ Object
- #edit(doc_num, doc) ⇒ Object
- #emit ⇒ Object
-
#initialize(opts = {}) ⇒ Stream
constructor
A new instance of Stream.
Constructor Details
#initialize(opts = {}) ⇒ Stream
Returns a new instance of Stream.
231 232 233 234 |
# File 'lib/jvyaml.rb', line 231 def initialize(opts = {}) @options = opts @documents = [] end |
Instance Attribute Details
#documents ⇒ Object
Returns the value of attribute documents.
230 231 232 |
# File 'lib/jvyaml.rb', line 230 def documents @documents end |
#options ⇒ Object
Returns the value of attribute options.
230 231 232 |
# File 'lib/jvyaml.rb', line 230 def @options end |
Instance Method Details
#[](i) ⇒ Object
236 237 238 |
# File 'lib/jvyaml.rb', line 236 def [](i) @documents[ i ] end |
#add(doc) ⇒ Object
240 241 242 |
# File 'lib/jvyaml.rb', line 240 def add(doc) @documents << doc end |
#each(&block) ⇒ Object
248 249 250 |
# File 'lib/jvyaml.rb', line 248 def each(&block) @documents.each(&block) end |
#edit(doc_num, doc) ⇒ Object
244 245 246 |
# File 'lib/jvyaml.rb', line 244 def edit(doc_num,doc) @documents[ doc_num ] = doc end |