Class: String

Inherits:
Object
  • Object
show all
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

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