swak 0.0.5 → 0.0.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/lib/swak.rb +13 -2
- metadata +2 -2
data/lib/swak.rb
CHANGED
|
@@ -14,7 +14,12 @@ class String
|
|
|
14
14
|
color_int = AnsiMap[color]
|
|
15
15
|
return "[#{fg ? 3 : 4}#{color_int}m#{self}[#{fg ? 3 : 4}9m"
|
|
16
16
|
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
#######################################################
|
|
20
|
+
#######################################################
|
|
17
21
|
|
|
22
|
+
class Object
|
|
18
23
|
def is_i?
|
|
19
24
|
true if Integer(self) rescue false
|
|
20
25
|
end
|
|
@@ -23,7 +28,6 @@ class String
|
|
|
23
28
|
true if Float(self) rescue false
|
|
24
29
|
end
|
|
25
30
|
|
|
26
|
-
|
|
27
31
|
def to_i_strict
|
|
28
32
|
if is_i?
|
|
29
33
|
return to_i
|
|
@@ -40,9 +44,16 @@ class String
|
|
|
40
44
|
raise "String '#{self}' cannot be converted to a float"
|
|
41
45
|
end
|
|
42
46
|
end
|
|
43
|
-
|
|
44
47
|
end
|
|
45
48
|
|
|
49
|
+
class NilClass
|
|
50
|
+
undef_method(:is_i?)
|
|
51
|
+
undef_method(:is_f?)
|
|
52
|
+
undef_method(:to_i_strict)
|
|
53
|
+
undef_method(:to_f_strict)
|
|
54
|
+
undef_method(:to_f)
|
|
55
|
+
undef_method(:to_i)
|
|
56
|
+
end
|
|
46
57
|
|
|
47
58
|
|
|
48
59
|
#######################################################
|
metadata
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: swak
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease:
|
|
5
|
-
version: 0.0.
|
|
5
|
+
version: 0.0.6
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- Jesse Rodriguez
|
|
@@ -10,7 +10,7 @@ autorequire:
|
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
12
|
|
|
13
|
-
date:
|
|
13
|
+
date: 2012-01-19 00:00:00 Z
|
|
14
14
|
dependencies: []
|
|
15
15
|
|
|
16
16
|
description: Random tools and mixins
|