Class: Validator

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

Overview

This class defines validation tools for data.

Class Method Summary collapse

Class Method Details

.hex?(value) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
12
13
# File 'lib/vtt2ass/validator.rb', line 6

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