deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@redhat.com
Subject [PATCH] [Core] DTACLOUD-464 alias Array.sample for ruby 1.8.7
Date Tue, 12 Feb 2013 10:27:15 GMT
From: marios <marios@redhat.com>

https://issues.apache.org/jira/browse/DTACLOUD-464

Signed-off-by: marios <marios@redhat.com>
---
 server/lib/deltacloud/core_ext/array.rb | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/server/lib/deltacloud/core_ext/array.rb b/server/lib/deltacloud/core_ext/array.rb
index 620b1f4..232b216 100644
--- a/server/lib/deltacloud/core_ext/array.rb
+++ b/server/lib/deltacloud/core_ext/array.rb
@@ -22,4 +22,9 @@ class Array
   def extract_opts!
     last.is_a?(Hash) ? pop : {}
   end
+
+  unless [].respond_to? :sample
+    alias :sample :choice
+  end
+
 end
-- 
1.7.11.7


Mime
View raw message