Class: Hydra::PCDM::Validators::CompositeValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/hydra/pcdm/validators/composite_validator.rb

Overview

Object which acts as one validator but delegates to many.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*validators) ⇒ CompositeValidator

Returns a new instance of CompositeValidator.



7
8
9
# File 'lib/hydra/pcdm/validators/composite_validator.rb', line 7

def initialize(*validators)
  @validators = validators.compact
end

Instance Attribute Details

#validatorsObject (readonly)

Returns the value of attribute validators.



5
6
7
# File 'lib/hydra/pcdm/validators/composite_validator.rb', line 5

def validators
  @validators
end

Instance Method Details

#validate!(reflection, record) ⇒ Object



11
12
13
14
15
# File 'lib/hydra/pcdm/validators/composite_validator.rb', line 11

def validate!(reflection, record)
  validators.each do |validator|
    validator.validate!(reflection, record)
  end
end