sane 0.24.5 → 0.24.6
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 +3 -1
- data/VERSION +1 -1
- data/lib/sane/present.rb +24 -0
- data/spec/spec.sane.rb +9 -0
- metadata +5 -4
data/ChangeLog
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.24.
|
|
1
|
+
0.24.6
|
data/lib/sane/present.rb
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
|
data/spec/spec.sane.rb
CHANGED
|
@@ -5,6 +5,7 @@ begin
|
|
|
5
5
|
require 'spec/autorun'
|
|
6
6
|
rescue LoadError
|
|
7
7
|
require 'rspec'
|
|
8
|
+
require 'rspec/autorun'
|
|
8
9
|
end
|
|
9
10
|
require 'fileutils'
|
|
10
11
|
|
|
@@ -189,4 +190,12 @@ describe Sane do
|
|
|
189
190
|
Socket.get_local_ips[0].should_not be nil
|
|
190
191
|
end
|
|
191
192
|
|
|
193
|
+
it 'should have present? method' do
|
|
194
|
+
assert !(''.present?)
|
|
195
|
+
assert 'a'.present?
|
|
196
|
+
assert !([].present?)
|
|
197
|
+
assert ['a'].present?
|
|
198
|
+
assert !(nil.present?)
|
|
199
|
+
end
|
|
200
|
+
|
|
192
201
|
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:
|
|
4
|
+
hash: 115
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 24
|
|
9
|
-
-
|
|
10
|
-
version: 0.24.
|
|
9
|
+
- 6
|
|
10
|
+
version: 0.24.6
|
|
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-
|
|
18
|
+
date: 2011-09-26 00:00:00 Z
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|
|
21
21
|
name: os
|
|
@@ -67,6 +67,7 @@ files:
|
|
|
67
67
|
- lib/sane/numeric.rb
|
|
68
68
|
- lib/sane/pp.rb
|
|
69
69
|
- lib/sane/pps.rb
|
|
70
|
+
- lib/sane/present.rb
|
|
70
71
|
- lib/sane/require_relative.rb
|
|
71
72
|
- lib/sane/sane_random.rb
|
|
72
73
|
- lib/sane/socket_ips.rb
|