swak 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/swak.rb +24 -0
  2. 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
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: swak
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.3
5
+ version: 0.0.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jesse Rodriguez