Class: Warc::Record::Validator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
lib/warc/record/validator.rb

Instance Method Summary collapse

Instance Method Details

#validate(header) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/warc/record/validator.rb', line 5

def validate(header)
  ["WARC-Record-ID","Content-Length","WARC-Date","WARC-Type"].each do |key|
    unless header.has_key?(key)
      header.errors[:base] << "#{key} is a required field"
    end
  end
end