diff options
author | Nobuyoshi Nakada <[email protected]> | 2022-03-19 22:42:54 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2022-03-24 13:16:13 +0900 |
commit | 9ed6875f9310be737ceca9b3034bbb34f1498068 (patch) | |
tree | 77b83b5c7a53c53d926ce2a82e4bce1d90b1f866 /tool/extlibs.rb | |
parent | 247f8ecfa441b120ad8cb43fa1f3a96145814cd1 (diff) |
extlibs.rb: Enclose `Vars` in `ExtLibs` class
To get rid of an unnecessary top-level constant for the case using
as a library.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5701
Diffstat (limited to 'tool/extlibs.rb')
-rwxr-xr-x | tool/extlibs.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tool/extlibs.rb b/tool/extlibs.rb index ff1d154667..c6c6d0cf65 100755 --- a/tool/extlibs.rb +++ b/tool/extlibs.rb @@ -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 |