ruby-changes:57914
From: bronzdoc <ko1@a...>
Date: Thu, 26 Sep 2019 18:11:27 +0900 (JST)
Subject: [ruby-changes:57914] 2e9c078707 (master): [rubygems/rubygems] Fix indentation in case statement
https://git.ruby-lang.org/ruby.git/commit/?id=2e9c078707 From 2e9c078707b8c87511c9fe45b7057086e214f6fb Mon Sep 17 00:00:00 2001 From: bronzdoc <lsagastume1990@g...> Date: Wed, 29 May 2019 20:23:59 -0600 Subject: [rubygems/rubygems] Fix indentation in case statement https://github.com/rubygems/rubygems/commit/8ac0647659 diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index ff54400..a41cbde 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -2293,19 +2293,19 @@ class Gem::Specification < Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L2293 def ruby_code(obj) case obj - when String then obj.dump + ".freeze" - when Array then '[' + obj.map { |x| ruby_code x }.join(", ") + ']' - when Hash then + when String then obj.dump + ".freeze" + when Array then '[' + obj.map { |x| ruby_code x }.join(", ") + ']' + when Hash then seg = obj.keys.sort.map { |k| "#{k.to_s.dump} => #{obj[k].to_s.dump}" } "{ #{seg.join(', ')} }" - when Gem::Version then obj.to_s.dump - when DateLike then obj.strftime('%Y-%m-%d').dump - when Time then obj.strftime('%Y-%m-%d').dump - when Numeric then obj.inspect - when true, false, nil then obj.inspect + when Gem::Version then obj.to_s.dump + when DateLike then obj.strftime('%Y-%m-%d').dump + when Time then obj.strftime('%Y-%m-%d').dump + when Numeric then obj.inspect + when true, false, nil then obj.inspect when OpenSSL::PKey::RSA then obj.class - when Gem::Platform then "Gem::Platform.new(#{obj.to_a.inspect})" - when Gem::Requirement then + when Gem::Platform then "Gem::Platform.new(#{obj.to_a.inspect})" + when Gem::Requirement then list = obj.as_list "Gem::Requirement.new(#{ruby_code(list.size == 1 ? obj.to_s : list)})" else raise Gem::Exception, "ruby_code case not handled: #{obj.class}" -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/