Skip to content

Commit 7da76a7

Browse files
authored
Merge pull request #713 from byroot/avoid-require
Avoid calls to `require` in hotspots
2 parents 5605134 + b77bfee commit 7da76a7

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/psych/nodes/node.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ def to_ruby(symbolize_names: false, freeze: false, strict_integer: false)
5555
#
5656
# See also Psych::Visitors::Emitter
5757
def yaml io = nil, options = {}
58-
require "stringio"
58+
require "stringio" unless defined?(StringIO)
59+
5960
real_io = io || StringIO.new(''.encode('utf-8'))
6061

6162
Visitors::Emitter.new(real_io, options).accept self

0 commit comments

Comments
 (0)