Class: DhEasy::Qa::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/dh_easy/qa/validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options={})
  load_config
  @options = options
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



4
5
6
# File 'lib/dh_easy/qa/validator.rb', line 4

def data
  @data
end

#errorsObject (readonly)

Returns the value of attribute errors.



4
5
6
# File 'lib/dh_easy/qa/validator.rb', line 4

def errors
  @errors
end

#local_configObject (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

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/dh_easy/qa/validator.rb', line 4

def options
  @options
end

Instance Method Details

#configHash

Configuration.

Returns:

  • (Hash)


25
26
27
# File 'lib/dh_easy/qa/validator.rb', line 25

def config
  @config ||= local_config['qa']
end

#config=(value) ⇒ Hash

Configuration.

Parameters:

  • value (Hash)

    Configuration.

Returns:

  • (Hash)


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, options).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