Skip to content

Commit

Permalink
Rename a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme committed Dec 1, 2023
1 parent 2005736 commit 4ae0d84
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/sass/embedded.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# @example
# Sass.compile_string('h1 { font-size: 40px; }')
module Sass
@instance = nil
@compiler = nil
@mutex = Mutex.new

# rubocop:disable Layout/LineLength
Expand All @@ -25,7 +25,7 @@ class << self
# @raise (see Compiler#compile)
# @see Compiler#compile
def compile(...)
instance.compile(...)
compiler.compile(...)
end

# Compiles a stylesheet whose contents is +source+ to CSS.
Expand All @@ -35,39 +35,39 @@ def compile(...)
# @raise (see Compiler#compile_string)
# @see Compiler#compile_string
def compile_string(...)
instance.compile_string(...)
compiler.compile_string(...)
end

# @param (see Compiler#info)
# @return (see Compiler#info)
# @raise (see Compiler#info)
# @see Compiler#info
def info
instance.info
compiler.info
end

private

def instance
return @instance if @instance
def compiler
return @compiler if @compiler

@mutex.synchronize do
return @instance if @instance
return @compiler if @compiler

instance = Compiler.new
compiler = Compiler.new

Process.singleton_class.prepend(Module.new do
define_method :_fork do
instance.close
compiler.close
super()
end
end)

at_exit do
instance.close
compiler.close
end

@instance = instance
@compiler = compiler
end
end
end
Expand Down

0 comments on commit 4ae0d84

Please sign in to comment.