Class: Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/vtt2ass/validator.rb

Class Method Summary collapse

Class Method Details

.hex?(value) ⇒ Boolean

Returns:

  • (Boolean)


2
3
4
5
6
7
8
9
# File 'lib/vtt2ass/validator.rb', line 2

def self.hex?(value)
    hex = true
    value.gsub!('#', '')
    value.chars.each do |digit|
      hex = false unless digit.match(/\h/)
    end
    return hex
end