kanamei-keystone 0.0.25 → 0.0.26

Sign up to get free protection for your applications and to get access to all the features.
data/lib/keystone.rb CHANGED
@@ -11,7 +11,7 @@ autoload :Moji , 'moji'
11
11
 
12
12
  module Keystone
13
13
 
14
- VERSION = '0.0.25'
14
+ VERSION = '0.0.26'
15
15
 
16
16
  autoload :StringUtil , 'keystone/string_util'
17
17
  autoload :Batch , 'keystone/batch'
@@ -14,4 +14,16 @@ class Array
14
14
  end
15
15
  return ret
16
16
  end
17
- end
17
+
18
+ if RUBY_VERSION < '1.8.7'
19
+ def sample(count=1)
20
+ if count == 1
21
+ return at( rand( size ) )
22
+ elsif count < 1
23
+ return nil
24
+ else
25
+ return sort_by{rand}[0..count-1]
26
+ end
27
+ end
28
+ end
29
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kanamei-keystone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.25
4
+ version: 0.0.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - kanamei