Class: JsonWriteStream::YieldingArrayWriter
Instance Attribute Summary
#index, #stream
Instance Method Summary
collapse
#flush, #initialize, #write_array, #write_object
Instance Method Details
#after_initialize ⇒ Object
105
106
107
|
# File 'lib/json-write-stream/yielding.rb', line 105
def after_initialize
stream.write('[')
end
|
#close ⇒ Object
116
117
118
|
# File 'lib/json-write-stream/yielding.rb', line 116
def close
stream.write(']')
end
|
#write_element(element, options = DEFAULT_OPTIONS) ⇒ Object
109
110
111
112
113
114
|
# File 'lib/json-write-stream/yielding.rb', line 109
def write_element(element, options = DEFAULT_OPTIONS)
write_comma
stream.write(options.fetch(:before, DEFAULT_OPTIONS[:before]))
increment
stream.write(escape(element))
end
|