Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/hacker_term/page_data.rb
Overview
Controversial monkeypatch of String class so it can tell us if a string is a number
Instance Method Summary collapse
Instance Method Details
#is_num? ⇒ Boolean
5 6 7 |
# File 'lib/hacker_term/page_data.rb', line 5 def is_num? self =~ /^[-+]?[0-9]*\.?[0-9]+$/ end |