ruby-changes:71489
From: Nobuyoshi <ko1@a...>
Date: Thu, 24 Mar 2022 13:16:34 +0900 (JST)
Subject: [ruby-changes:71489] 9ed6875f93 (master): extlibs.rb: Enclose `Vars` in `ExtLibs` class
https://git.ruby-lang.org/ruby.git/commit/?id=9ed6875f93 From 9ed6875f9310be737ceca9b3034bbb34f1498068 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sat, 19 Mar 2022 22:42:54 +0900 Subject: extlibs.rb: Enclose `Vars` in `ExtLibs` class To get rid of an unnecessary top-level constant for the case using as a library. --- tool/extlibs.rb | 22 +++++++++++----------- 1 file 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' https://github.com/ruby/ruby/blob/trunk/tool/extlibs.rb#L7 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 -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/