swak 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- 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
|