diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-21 14:46:36 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-21 14:46:36 -0700 |
| commit | a0de3288bad113c9be1190095b03e892e17000d2 (patch) | |
| tree | 3831d103510aa12c4a37a8d62c0e7032df14f1ce /lib/puppet/util | |
| parent | c5ba77eff86ffedb4979b6968db0e2520dd1da25 (diff) | |
| download | puppet-a0de3288bad113c9be1190095b03e892e17000d2.tar.gz puppet-a0de3288bad113c9be1190095b03e892e17000d2.tar.xz puppet-a0de3288bad113c9be1190095b03e892e17000d2.zip | |
(#6928) backport Symbol#to_proc for Ruby < 1.8.7
We use the &:foo symbol-to-proc syntax in some of our code, so to avoid
problems on Ruby earlier than 1.8.7 we should backport the support in our
monkey-patch file.
Reviewed-By: Max Martin <max@puppetlabs.com>
Diffstat (limited to 'lib/puppet/util')
| -rw-r--r-- | lib/puppet/util/monkey_patches.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/puppet/util/monkey_patches.rb b/lib/puppet/util/monkey_patches.rb index 10a268409..9ae0ca6a2 100644 --- a/lib/puppet/util/monkey_patches.rb +++ b/lib/puppet/util/monkey_patches.rb @@ -104,3 +104,12 @@ class Array end end unless method_defined? :combination end + + +if Symbol.instance_method(:to_proc).nil? + class Symbol + def to_proc + Proc.new { |*args| args.shift.__send__(self, *args) } + end + end +end |
