Method: CFF::File#validate!

Defined in:
lib/cff/file.rb

#validate!(fail_fast: false, fail_on_filename: true) ⇒ Object

:call-seq:

validate!(fail_fast: false, fail_on_filename: true)

Validate this file and raise a ValidationError upon failure. If an error is raised it will contain the detected validation failures for further inspection.

You can choose whether filename validation failure should cause overall validation failure with the fail_on_filename parameter (default: true).

Raises:



177
178
179
180
181
182
183
184
# File 'lib/cff/file.rb', line 177

def validate!(fail_fast: false, fail_on_filename: true)
  result = validate(
    fail_fast: fail_fast, fail_on_filename: fail_on_filename
  )
  return if result[0]

  raise ValidationError.new(result[1], invalid_filename: !result[2])
end