Class: DhEasy::Qa::Validator
- Inherits:
-
Object
- Object
- DhEasy::Qa::Validator
- Defined in:
- lib/dh_easy/qa/validator.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#local_config ⇒ Object
readonly
Returns the value of attribute local_config.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#config ⇒ Hash
Configuration.
-
#config=(value) ⇒ Hash
Configuration.
-
#initialize(data = nil, options = {}) ⇒ Validator
constructor
A new instance of Validator.
-
#validate_external(outputs, collection_name) ⇒ Object
this method is for validating data from “external” sources.
-
#validate_internal(vars, outputs) ⇒ Object
this method is for validating “internal” scrapers that run on Datahen.
Constructor Details
#initialize(data = nil, options = {}) ⇒ Validator
Returns a new instance of Validator.
6 7 8 9 10 |
# File 'lib/dh_easy/qa/validator.rb', line 6 def initialize(data=nil, ={}) load_config @options = @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
4 5 6 |
# File 'lib/dh_easy/qa/validator.rb', line 4 def data @data end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
4 5 6 |
# File 'lib/dh_easy/qa/validator.rb', line 4 def errors @errors end |
#local_config ⇒ Object (readonly)
Returns the value of attribute local_config.
4 5 6 |
# File 'lib/dh_easy/qa/validator.rb', line 4 def local_config @local_config end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/dh_easy/qa/validator.rb', line 4 def @options end |
Instance Method Details
#config ⇒ Hash
Configuration.
25 26 27 |
# File 'lib/dh_easy/qa/validator.rb', line 25 def config @config ||= local_config['qa'] end |
#config=(value) ⇒ Hash
Configuration.
34 35 36 |
# File 'lib/dh_easy/qa/validator.rb', line 34 def config=value @config = value end |
#validate_external(outputs, collection_name) ⇒ Object
this method is for validating data from “external” sources
18 19 20 |
# File 'lib/dh_easy/qa/validator.rb', line 18 def validate_external(outputs, collection_name) ValidateExternal.new(data, config, outputs, collection_name, ).run end |
#validate_internal(vars, outputs) ⇒ Object
this method is for validating “internal” scrapers that run on Datahen
13 14 15 |
# File 'lib/dh_easy/qa/validator.rb', line 13 def validate_internal(vars, outputs) ValidateInternal.new(vars, config, outputs).run end |