diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-05-09 13:13:45 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-05-09 13:13:45 -0700 |
commit | cfd1616d7526da6b403985826d3a9339bfbce754 (patch) | |
tree | 0ffd34cdb4919d677a85bc4b88b07e46e070c1ee | |
parent | 1686ce2314f9b4be1587b648b960ef222375eb37 (diff) | |
download | chef-cfd1616d7526da6b403985826d3a9339bfbce754.tar.gz |
the =~ in ruby is awful
if you decorate/delegate =~ you can't update the capture variables
which are local to the calling context.
maybe something could be done to update the $~ in the binding of
the caller, but i don't want to do that today...
-rw-r--r-- | lib/chef/provider/package/yum.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/provider/package/yum.rb b/lib/chef/provider/package/yum.rb index dfd32fde55..37224ef4ca 100644 --- a/lib/chef/provider/package/yum.rb +++ b/lib/chef/provider/package/yum.rb @@ -46,7 +46,7 @@ class Chef lead = 0 tail = evr.size - if evr =~ %r{^([\d]+):} + if %r{^([\d]+):}.match(evr) epoch = $1.to_i lead = $1.length + 1 elsif evr[0].ord == ":".ord @@ -54,7 +54,7 @@ class Chef lead = 1 end - if evr =~ %r{:?.*-(.*)$} + if %r{:?.*-(.*)$}.match(evr) release = $1 tail = evr.length - release.length - lead - 1 @@ -443,7 +443,7 @@ class Chef # "mtr >= 2:0.71-3.0" # "mta" def self.parse(string) - if string =~ %r{^(\S+)\s+(>|>=|=|==|<=|<)\s+(\S+)$} + if %r{^(\S+)\s+(>|>=|=|==|<=|<)\s+(\S+)$}.match(string) name = $1 if $2 == "=" flag = :== |