swak 0.0.3 → 0.0.4
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 +24 -0
- metadata +1 -1
data/lib/swak.rb
CHANGED
@@ -23,8 +23,32 @@ class String
|
|
23
23
|
true if Float(self) rescue false
|
24
24
|
end
|
25
25
|
|
26
|
+
|
27
|
+
def to_i_strict
|
28
|
+
if is_i?
|
29
|
+
return to_i
|
30
|
+
else
|
31
|
+
raise "String '#{self}' cannot be converted to an int"
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
def to_f_strict
|
37
|
+
if is_f?
|
38
|
+
return to_f
|
39
|
+
else
|
40
|
+
raise "String '#{self}' cannot be converted to a float"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
26
44
|
end
|
27
45
|
|
46
|
+
|
47
|
+
|
48
|
+
#######################################################
|
49
|
+
#######################################################
|
50
|
+
|
51
|
+
|
28
52
|
class Array
|
29
53
|
|
30
54
|
def hist
|