Skip to content

Commit

Permalink
Merge pull request #713 from byroot/avoid-require
Browse files Browse the repository at this point in the history
Avoid calls to `require` in hotspots
  • Loading branch information
tenderlove authored Feb 6, 2025
2 parents 5605134 + b77bfee commit 7da76a7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/psych/nodes/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def to_ruby(symbolize_names: false, freeze: false, strict_integer: false)
#
# See also Psych::Visitors::Emitter
def yaml io = nil, options = {}
require "stringio"
require "stringio" unless defined?(StringIO)

real_io = io || StringIO.new(''.encode('utf-8'))

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

0 comments on commit 7da76a7

Please sign in to comment.