[前][次][番号順一覧][スレッド一覧]

ruby-changes:61726

From: David <ko1@a...>
Date: Mon, 15 Jun 2020 21:21:03 +0900 (JST)
Subject: [ruby-changes:61726] 955f1837a1 (master): Use space inside block braces everywhere

https://git.ruby-lang.org/ruby.git/commit/?id=955f1837a1

From 955f1837a180d8936f90ab6cf039ccb8f751be72 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Wed, 10 Jun 2020 19:46:05 +0200
Subject: Use space inside block braces everywhere

To make rubygems code style consistent with bundler.

diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index ca80326..5f0579b 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -504,7 +504,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L504
 
     gem_specifications = @gemdeps ? Gem.loaded_specs.values : Gem::Specification.stubs
 
-    files.concat gem_specifications.map { |spec|
+    files.concat gem_specifications.map {|spec|
       spec.matches_for_glob("#{glob}#{Gem.suffix_pattern}")
     }.flatten
 
@@ -519,7 +519,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L519
     glob_with_suffixes = "#{glob}#{Gem.suffix_pattern}"
     $LOAD_PATH.map do |load_path|
       Gem::Util.glob_files_in_dir(glob_with_suffixes, load_path)
-    end.flatten.select { |file| File.file? file.tap(&Gem::UNTAINT) }
+    end.flatten.select {|file| File.file? file.tap(&Gem::UNTAINT) }
   end
 
   ##
@@ -539,7 +539,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L539
 
     files = find_files_from_load_path glob if check_load_path
 
-    files.concat Gem::Specification.latest_specs(true).map { |spec|
+    files.concat Gem::Specification.latest_specs(true).map {|spec|
       spec.matches_for_glob("#{glob}#{Gem.suffix_pattern}")
     }.flatten
 
@@ -1014,7 +1014,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L1014
     paths.flatten!
     paths.compact!
     hash = { "GEM_HOME" => home, "GEM_PATH" => paths.empty? ? home : paths.join(File::PATH_SEPARATOR) }
-    hash.delete_if { |_, v| v.nil? }
+    hash.delete_if {|_, v| v.nil? }
     self.paths = hash
   end
 
@@ -1024,7 +1024,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L1024
   def self.win_platform?
     if @@win_platform.nil?
       ruby_platform = RbConfig::CONFIG['host_os']
-      @@win_platform = !!WIN_PATTERNS.find { |r| ruby_platform =~ r }
+      @@win_platform = !!WIN_PATTERNS.find {|r| ruby_platform =~ r }
     end
 
     @@win_platform
@@ -1101,7 +1101,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L1101
 
     if path == "-"
       Gem::Util.traverse_parents Dir.pwd do |directory|
-        dep_file = GEM_DEP_FILES.find { |f| File.file?(f) }
+        dep_file = GEM_DEP_FILES.find {|f| File.file?(f) }
 
         next unless dep_file
 
@@ -1212,7 +1212,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L1212
     #
 
     def register_default_spec(spec)
-      extended_require_paths = spec.require_paths.map {|f| f + "/"}
+      extended_require_paths = spec.require_paths.map {|f| f + "/" }
       new_format = extended_require_paths.any? {|path| spec.files.any? {|f| f.start_with? path } }
 
       if new_format
diff --git a/lib/rubygems/available_set.rb b/lib/rubygems/available_set.rb
index 2e9d949..48bf6da 100644
--- a/lib/rubygems/available_set.rb
+++ b/lib/rubygems/available_set.rb
@@ -70,11 +70,11 @@ class Gem::AvailableSet https://github.com/ruby/ruby/blob/trunk/lib/rubygems/available_set.rb#L70
   end
 
   def all_specs
-    @set.map { |t| t.spec }
+    @set.map {|t| t.spec }
   end
 
   def match_platform!
-    @set.reject! { |t| !Gem::Platform.match(t.spec.platform) }
+    @set.reject! {|t| !Gem::Platform.match(t.spec.platform) }
     @sorted = nil
     self
   end
@@ -91,7 +91,7 @@ class Gem::AvailableSet https://github.com/ruby/ruby/blob/trunk/lib/rubygems/available_set.rb#L91
   end
 
   def source_for(spec)
-    f = @set.find { |t| t.spec == spec }
+    f = @set.find {|t| t.spec == spec }
     f.source
   end
 
@@ -160,7 +160,7 @@ class Gem::AvailableSet https://github.com/ruby/ruby/blob/trunk/lib/rubygems/available_set.rb#L160
   end
 
   def inject_into_list(dep_list)
-    @set.each { |t| dep_list.add t.spec }
+    @set.each {|t| dep_list.add t.spec }
   end
 
 end
diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb
index 0e65f26..ce07cdc 100644
--- a/lib/rubygems/basic_specification.rb
+++ b/lib/rubygems/basic_specification.rb
@@ -276,7 +276,7 @@ class Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/basic_specification.rb#L276
   def matches_for_glob(glob) # TODO: rename?
     glob = File.join(self.lib_dirs_glob, glob)
 
-    Dir[glob].map { |f| f.tap(&Gem::UNTAINT) } # FIX our tests are broken, run w/ SAFE=1
+    Dir[glob].map {|f| f.tap(&Gem::UNTAINT) } # FIX our tests are broken, run w/ SAFE=1
   end
 
   ##
@@ -335,12 +335,12 @@ class Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/basic_specification.rb#L335
   def have_file?(file, suffixes)
     return true if raw_require_paths.any? do |path|
       base = File.join(gems_dir, full_name, path.tap(&Gem::UNTAINT), file).tap(&Gem::UNTAINT)
-      suffixes.any? { |suf| File.file? base + suf }
+      suffixes.any? {|suf| File.file? base + suf }
     end
 
     if have_extensions?
       base = File.join extension_dir, file
-      suffixes.any? { |suf| File.file? base + suf }
+      suffixes.any? {|suf| File.file? base + suf }
     else
       false
     end
diff --git a/lib/rubygems/bundler_version_finder.rb b/lib/rubygems/bundler_version_finder.rb
index ea6698f..56ca14f 100644
--- a/lib/rubygems/bundler_version_finder.rb
+++ b/lib/rubygems/bundler_version_finder.rb
@@ -44,9 +44,9 @@ To install the missing version, run `gem install bundler:#{vr.first}` https://github.com/ruby/ruby/blob/trunk/lib/rubygems/bundler_version_finder.rb#L44
   def self.filter!(specs)
     return unless bundler_version = self.bundler_version
 
-    specs.reject! { |spec| spec.version.segments.first != bundler_version.segments.first }
+    specs.reject! {|spec| spec.version.segments.first != bundler_version.segments.first }
 
-    exact_match_index = specs.find_index { |spec| spec.version == bundler_version }
+    exact_match_index = specs.find_index {|spec| spec.version == bundler_version }
     return unless exact_match_index
 
     specs.unshift(specs.delete_at(exact_match_index))
@@ -86,7 +86,7 @@ To install the missing version, run `gem install bundler:#{vr.first}` https://github.com/ruby/ruby/blob/trunk/lib/rubygems/bundler_version_finder.rb#L86
     unless gemfile
       begin
         Gem::Util.traverse_parents(Dir.pwd) do |directory|
-          next unless gemfile = Gem::GEM_DEP_FILES.find { |f| File.file?(f.tap(&Gem::UNTAINT)) }
+          next unless gemfile = Gem::GEM_DEP_FILES.find {|f| File.file?(f.tap(&Gem::UNTAINT)) }
 
           gemfile = File.join directory, gemfile
           break
diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb
index f08749b..cfbe34c 100644
--- a/lib/rubygems/command.rb
+++ b/lib/rubygems/command.rb
@@ -125,7 +125,7 @@ class Gem::Command https://github.com/ruby/ruby/blob/trunk/lib/rubygems/command.rb#L125
     @program_name = "gem #{command}"
     @defaults = defaults
     @options = defaults.dup
-    @option_groups = Hash.new { |h,k| h[k] = [] }
+    @option_groups = Hash.new {|h,k| h[k] = [] }
     @deprecated_options = { command => {} }
     @parser = nil
     @when_invoked = nil
@@ -162,7 +162,7 @@ class Gem::Command https://github.com/ruby/ruby/blob/trunk/lib/rubygems/command.rb#L162
 
     if errors and !errors.empty?
       msg << ", here is why:\n"
-      errors.each { |x| msg << "          #{x.wordy}\n" }
+      errors.each {|x| msg << "          #{x.wordy}\n" }
     else
       if required_by and gem != required_by
         msg << " (required by #{required_by}) in any repository"
@@ -192,7 +192,7 @@ class Gem::Command https://github.com/ruby/ruby/blob/trunk/lib/rubygems/command.rb#L192
             "Please specify at least one gem name (e.g. gem build GEMNAME)"
     end
 
-    args.select { |arg| arg !~ /^-/ }
+    args.select {|arg| arg !~ /^-/ }
   end
 
   ##
@@ -364,7 +364,7 @@ class Gem::Command https://github.com/ruby/ruby/blob/trunk/lib/rubygems/command.rb#L364
 
   def remove_option(name)
     @option_groups.each do |_, option_list|
-      option_list.reject! { |args, _| args.any? { |x| x.is_a?(String) && x =~ /^#{name}/ } }
+      option_list.reject! {|args, _| args.any? {|x| x.is_a?(String) && x =~ /^#{name}/ } }
     end
   end
 
@@ -417,7 +417,7 @@ class Gem::Command https://github.com/ruby/ruby/blob/trunk/lib/rubygems/command.rb#L417
 
   def merge_options(new_options)
     @options = @defaults.clone
-    new_options.each { |k,v| @options[k] = v }
+    new_options.each {|k,v| @options[k] = v }
   end
 
   ##
@@ -496,7 +496,7 @@ class Gem::Command https://github.com/ruby/ruby/blob/trunk/lib/rubygems/command.rb#L496
 
     configure_options "", regular_options
 
-    @option_groups.sort_by { |n,_| n.to_s }.each do |group_name, option_list|
+    @option_groups.sort_by {|n,_| n.to_s }.each do |group_name, option_list|
       @parser.separator nil
       configure_options group_name, option_list
     end
diff --git a/lib/rubygems/command_manager.rb b/lib/rubygems/command_manager.rb
index 03b859e..f18e777 100644
--- a/lib/rubygems/command_manager.rb
+++ b/lib/rubygems/command_manager.rb
@@ -138,7 +138,7 @@ class Gem::CommandManager https://github.com/ruby/ruby/blob/trunk/lib/rubygems/command_manager.rb#L138
   # Return a sorted list of all command names as strings.
 
   def command_names
-    @commands.keys.collect {|key| key.to_s}.sort
+    @commands.keys.collect {|key| key.to_s }.sort
   end
 
   ##
@@ -203,9 +203,9 @@ class Gem::CommandManager https://gi (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]