ruby-nuggets 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/lib/nuggets/string/msub.rb +6 -1
- data/lib/nuggets/version.rb +1 -1
- metadata +1 -1
data/README
CHANGED
data/lib/nuggets/string/msub.rb
CHANGED
@@ -67,7 +67,10 @@ class String
|
|
67
67
|
}
|
68
68
|
|
69
69
|
gsub!(Regexp.union(*keys)) { |match|
|
70
|
-
cache[match] ||=
|
70
|
+
cache[match] ||= begin
|
71
|
+
eval("__match__ = #{match.inspect}", binding)
|
72
|
+
subs.find { |key, _| key =~ match }.last.evaluate(binding)
|
73
|
+
end
|
71
74
|
}
|
72
75
|
end
|
73
76
|
|
@@ -90,4 +93,6 @@ if $0 == __FILE__
|
|
90
93
|
warn err
|
91
94
|
end
|
92
95
|
p s.msub('r' => '???', 'z' => '#{t}', :__binding__ => binding)
|
96
|
+
|
97
|
+
p s.msub(/[A-Z]/ => '#{__match__.downcase}', :__binding__ => binding)
|
93
98
|
end
|
data/lib/nuggets/version.rb
CHANGED