mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
0b396d5880
* Rely on encoding tags to determine if string should be dumped as binary.
8949a47b8c
* Specify "frozen_string_literal: true".
* Support to binary release for mingw32 platform.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
28 lines
667 B
Ruby
28 lines
667 B
Ruby
# frozen_string_literal: true
|
|
module Psych
|
|
module Streaming
|
|
module ClassMethods
|
|
###
|
|
# Create a new streaming emitter. Emitter will print to +io+. See
|
|
# Psych::Stream for an example.
|
|
def new io
|
|
emitter = const_get(:Emitter).new(io)
|
|
class_loader = ClassLoader.new
|
|
ss = ScalarScanner.new class_loader
|
|
super(emitter, ss, {})
|
|
end
|
|
end
|
|
|
|
###
|
|
# Start streaming using +encoding+
|
|
def start encoding = Nodes::Stream::UTF8
|
|
super.tap { yield self if block_given? }
|
|
ensure
|
|
finish if block_given?
|
|
end
|
|
|
|
private
|
|
def register target, obj
|
|
end
|
|
end
|
|
end
|