sane 0.24.6 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ChangeLog CHANGED
@@ -1,3 +1,5 @@
1
+ 0.25.0 : add Array#sample, try to add sanity to release numberings, since the ones previous seemed bworked ?
2
+
1
3
  0.24.6 : add present?
2
4
 
3
5
  0.23.6 add Socket.get_host_ips, remove dependency on andand until I need it again.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.24.6
1
+ 0.25.0
@@ -0,0 +1,15 @@
1
+ module Enumerable
2
+ def ave
3
+ sum = 0
4
+ self.each{|value| sum += value}
5
+ return sum.to_f/self.length
6
+ end
7
+
8
+ if RUBY_VERSION < '1.9.0'
9
+ def sample
10
+ me = to_a
11
+ me[rand(me.length)]
12
+ end
13
+ end
14
+
15
+ end
@@ -62,7 +62,6 @@ module Kernel
62
62
 
63
63
  def __DIR__
64
64
  dir = (/^(.+)?:\d+/ =~ caller[0]) ? File.expand_path(File.dirname($1), BASE_DIR) : nil
65
- dir += '/' if dir
66
65
  dir
67
66
  end unless defined?(__DIR__)
68
67
  # deemed too unfriendly since it would
data/spec/spec.sane.rb CHANGED
@@ -198,4 +198,8 @@ describe Sane do
198
198
  assert !(nil.present?)
199
199
  end
200
200
 
201
+ it 'should have Array#sample' do
202
+ [2].sample.should == 2
203
+ end
204
+
201
205
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sane
3
3
  version: !ruby/object:Gem::Version
4
- hash: 115
4
+ hash: 123
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 24
9
- - 6
10
- version: 0.24.6
8
+ - 25
9
+ - 0
10
+ version: 0.25.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Roger Pack
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-26 00:00:00 Z
18
+ date: 2011-12-13 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: os
@@ -49,13 +49,13 @@ files:
49
49
  - VERSION
50
50
  - lib/_dbg.rb
51
51
  - lib/sane.rb
52
- - lib/sane/array_ave.rb
53
52
  - lib/sane/array_blank.rb
54
53
  - lib/sane/array_contain.rb
55
54
  - lib/sane/array_select_bang.rb
56
55
  - lib/sane/assert.rb
57
56
  - lib/sane/bugs.rb
58
57
  - lib/sane/contain.rb
58
+ - lib/sane/enumerable.rb
59
59
  - lib/sane/file.rb
60
60
  - lib/sane/file_filename.rb
61
61
  - lib/sane/file_home.rb
@@ -67,7 +67,6 @@ files:
67
67
  - lib/sane/numeric.rb
68
68
  - lib/sane/pp.rb
69
69
  - lib/sane/pps.rb
70
- - lib/sane/present.rb
71
70
  - lib/sane/require_relative.rb
72
71
  - lib/sane/sane_random.rb
73
72
  - lib/sane/socket_ips.rb
@@ -1,7 +0,0 @@
1
- module Enumerable
2
- def ave
3
- sum = 0
4
- self.each{|value| sum += value}
5
- return sum.to_f/self.length
6
- end
7
- end
data/lib/sane/present.rb DELETED
@@ -1,24 +0,0 @@
1
- # LODO move to sane :) also remove the andand dep.
2
- class String
3
- def present?
4
- length > 0
5
- end
6
- end
7
-
8
- class NilClass
9
- def present?
10
- false
11
- end
12
- end
13
- class Object
14
- def present?
15
- true
16
- end
17
- end
18
-
19
- class Array
20
- def present?
21
- length > 0
22
- end
23
- end
24
-