1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

extlibs.rb: Enclose Vars in ExtLibs class

To get rid of an unnecessary top-level constant for the case using
as a library.
This commit is contained in:
Nobuyoshi Nakada 2022-03-19 22:42:54 +09:00
parent 247f8ecfa4
commit 9ed6875f93
Notes: git 2022-03-24 13:16:39 +09:00

View file

@ -7,21 +7,21 @@ require 'digest'
require_relative 'downloader'
require_relative 'lib/colorize'
class Vars < Hash
def pattern
/\$\((#{Regexp.union(keys)})\)/
end
class ExtLibs
class Vars < Hash
def pattern
/\$\((#{Regexp.union(keys)})\)/
end
def expand(str)
if empty?
str
else
str.gsub(pattern) {self[$1]}
def expand(str)
if empty?
str
else
str.gsub(pattern) {self[$1]}
end
end
end
end
class ExtLibs
def initialize(mode = :all, cache_dir: nil)
@mode = mode
@cache_dir = cache_dir