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
5 6 7 8 9 10 11 |
# File 'lib/string_ext.rb', line 5 def is_number? begin true if Float(self) rescue # rubocop:disable Style/RescueStandardError false end end |
#trim ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/string_ext.rb', line 13 def trim trimmed = strip if trimmed.nil? self else trimmed end end |