[cairo] [PATCH 7/7] Rename variables shadowing outer variables

Nikolai Weibull now at bitwi.se
Fri Sep 16 01:32:45 PDT 2011


---
 lib/cairo/color.rb        |    6 +++---
 lib/cairo/context/path.rb |    3 ++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/cairo/color.rb b/lib/cairo/color.rb
index e14f0f1..c76486e 100644
--- a/lib/cairo/color.rb
+++ b/lib/cairo/color.rb
@@ -35,11 +35,11 @@ module Cairo
     def parse_hex_color(value)
       case value
       when /\A#((?:#{HEX_RE}){3,4})\z/ #
-        RGB.new(*$1.scan(/./).collect {|value| value.hex / 15.0})
+        RGB.new(*$1.scan(/./).collect {|part| part.hex / 15.0})
       when /\A#((?:#{HEX_RE}{2,2}){3,4})\z/ #
-        RGB.new(*$1.scan(/.{2,2}/).collect {|value| value.hex / 255.0})
+        RGB.new(*$1.scan(/.{2,2}/).collect {|part| part.hex / 255.0})
       when /\A#((?:#{HEX_RE}{4,4}){3,4})\z/ #
-        RGB.new(*$1.scan(/.{4,4}/).collect {|value| value.hex / 65535.0})
+        RGB.new(*$1.scan(/.{4,4}/).collect {|part| part.hex / 65535.0})
       else
         message = "invalid hex color format: #{value} should be "
         message << "#RGB, #RGBA, #RRGGBB, #RRGGBBAA, #RRRRGGGGBBBB "
diff --git a/lib/cairo/context/path.rb b/lib/cairo/context/path.rb
index 7cda0d7..78e05bd 100644
--- a/lib/cairo/context/path.rb
+++ b/lib/cairo/context/path.rb
@@ -25,7 +25,8 @@ module Cairo
           d = x
           i = -1
           type = points = nil
-          path.each do |type, points|
+          path.each do |btype, bpoints|
+            type, points = btype, bpoints
             i += 1
             break if d < parameterized_path[i]
             d -= parameterized_path[i]
-- 
1.7.5.1



More information about the cairo mailing list