ruby-changes:55583
From: Takashi <ko1@a...>
Date: Sun, 28 Apr 2019 21:41:19 +0900 (JST)
Subject: [ruby-changes:55583] Takashi Kokubun:fcb1875513 (trunk): Make Merger.version private to the module
https://git.ruby-lang.org/ruby.git/commit/?id=fcb1875513 From fcb18755135982320900c45baa45bd4ba0029e07 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Sun, 28 Apr 2019 21:16:20 +0900 Subject: Make Merger.version private to the module because it's not used outside the Module. diff --git a/tool/merger.rb b/tool/merger.rb index a210a92..60cb000 100755 --- a/tool/merger.rb +++ b/tool/merger.rb @@ -46,36 +46,6 @@ module Merger https://github.com/ruby/ruby/blob/trunk/tool/merger.rb#L46 end end - # Prints the version of Ruby found in version.h -def version - v = p = nil - open 'version.h', 'rb' do |f| - f.each_line do |l| - case l - when /^#define RUBY_VERSION "(\d+)\.(\d+)\.(\d+)"$/ - v = $~.captures - when /^#define RUBY_VERSION_TEENY (\d+)$/ - (v ||= [])[2] = $1 - when /^#define RUBY_PATCHLEVEL (-?\d+)$/ - p = $1 - end - end - end - if v and !v[0] - open 'include/ruby/version.h', 'rb' do |f| - f.each_line do |l| - case l - when /^#define RUBY_API_VERSION_MAJOR (\d+)/ - v[0] = $1 - when /^#define RUBY_API_VERSION_MINOR (\d+)/ - v[1] = $1 - end - end - end - end - return v, p -end - def interactive str, editfile = nil loop do yield @@ -202,6 +172,38 @@ end https://github.com/ruby/ruby/blob/trunk/tool/merger.rb#L172 def default_merge_branch %r{^URL: .*/branches/ruby_1_8_} =~ `svn info` ? 'branches/ruby_1_8' : 'trunk' end + + private + + # Prints the version of Ruby found in version.h + def version + v = p = nil + open 'version.h', 'rb' do |f| + f.each_line do |l| + case l + when /^#define RUBY_VERSION "(\d+)\.(\d+)\.(\d+)"$/ + v = $~.captures + when /^#define RUBY_VERSION_TEENY (\d+)$/ + (v ||= [])[2] = $1 + when /^#define RUBY_PATCHLEVEL (-?\d+)$/ + p = $1 + end + end + end + if v and !v[0] + open 'include/ruby/version.h', 'rb' do |f| + f.each_line do |l| + case l + when /^#define RUBY_API_VERSION_MAJOR (\d+)/ + v[0] = $1 + when /^#define RUBY_API_VERSION_MINOR (\d+)/ + v[1] = $1 + end + end + end + end + return v, p + end end # class << self end # module Merger -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/