Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/string_ext.rb
Instance Method Summary collapse
-
#is_number? ⇒ Boolean
see if string is numeric.
- #trim ⇒ Object
Instance Method Details
#is_number? ⇒ Boolean
see if string is numeric
3 4 5 |
# File 'lib/string_ext.rb', line 3 def is_number? true if Float(self) rescue false end |
#trim ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/string_ext.rb', line 7 def trim trimmed = self.strip if trimmed == nil self else trimmed end end |