Class: Roast::Workflow::Validators::BaseValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/roast/workflow/validators/base_validator.rb

Overview

Base class for all validators

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parsed_yaml, workflow_path = nil) ⇒ BaseValidator

Returns a new instance of BaseValidator.



10
11
12
13
14
15
# File 'lib/roast/workflow/validators/base_validator.rb', line 10

def initialize(parsed_yaml, workflow_path = nil)
  @parsed_yaml = parsed_yaml
  @workflow_path = workflow_path
  @errors = []
  @warnings = []
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



8
9
10
# File 'lib/roast/workflow/validators/base_validator.rb', line 8

def errors
  @errors
end

#warningsObject (readonly)

Returns the value of attribute warnings.



8
9
10
# File 'lib/roast/workflow/validators/base_validator.rb', line 8

def warnings
  @warnings
end

Instance Method Details

#valid?Boolean

Returns:



21
22
23
24
# File 'lib/roast/workflow/validators/base_validator.rb', line 21

def valid?
  validate
  @errors.empty?
end

#validateObject

Raises:



17
18
19
# File 'lib/roast/workflow/validators/base_validator.rb', line 17

def validate
  raise NotImplementedError, "Subclasses must implement validate"
end