Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/spectools.rb
Overview
We define here an extension to the String class to test if the string contains a valid Hex Code
Instance Method Summary collapse
-
#hex? ⇒ Boolean
:nodoc:.
Instance Method Details
#hex? ⇒ Boolean
:nodoc:
11 12 13 |
# File 'lib/spectools.rb', line 11 def hex? !((self =~ /^0x[a-fA-F0-9]+$/).nil?) end |