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:
parent
247f8ecfa4
commit
9ed6875f93
Notes:
git
2022-03-24 13:16:39 +09:00
1 changed files with 11 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue