Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/ext.rb
Instance Method Summary collapse
Instance Method Details
#is_int?(str) ⇒ Boolean
6 7 8 9 10 11 |
# File 'lib/ext.rb', line 6 def is_int?(str) Integer(str) true rescue ArgumentError false end |
#numstr_to_i ⇒ Object
2 3 4 |
# File 'lib/ext.rb', line 2 def numstr_to_i is_int?(self) ? self.to_i : self end |