Class: AeEasy::Qa::ValidateExternal
- Inherits:
-
Object
- Object
- AeEasy::Qa::ValidateExternal
- Defined in:
- lib/ae_easy/qa/validate_external.rb
Instance Attribute Summary collapse
-
#collection_name ⇒ Object
readonly
Returns the value of attribute collection_name.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#outputs ⇒ Object
readonly
Returns the value of attribute outputs.
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
Instance Method Summary collapse
-
#initialize(data, config, outputs, collection_name, options) ⇒ ValidateExternal
constructor
A new instance of ValidateExternal.
- #run ⇒ Object
Constructor Details
#initialize(data, config, outputs, collection_name, options) ⇒ ValidateExternal
Returns a new instance of ValidateExternal.
6 7 8 9 10 11 12 13 |
# File 'lib/ae_easy/qa/validate_external.rb', line 6 def initialize(data, config, outputs, collection_name, ) @data = data @rules = config['individual_validations'] if config @outputs = outputs @collection_name = collection_name @options = @errors = { errored_items: [] } end |
Instance Attribute Details
#collection_name ⇒ Object (readonly)
Returns the value of attribute collection_name.
4 5 6 |
# File 'lib/ae_easy/qa/validate_external.rb', line 4 def collection_name @collection_name end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
4 5 6 |
# File 'lib/ae_easy/qa/validate_external.rb', line 4 def data @data end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
4 5 6 |
# File 'lib/ae_easy/qa/validate_external.rb', line 4 def errors @errors end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/ae_easy/qa/validate_external.rb', line 4 def @options end |
#outputs ⇒ Object (readonly)
Returns the value of attribute outputs.
4 5 6 |
# File 'lib/ae_easy/qa/validate_external.rb', line 4 def outputs @outputs end |
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
4 5 6 |
# File 'lib/ae_easy/qa/validate_external.rb', line 4 def rules @rules end |
Instance Method Details
#run ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ae_easy/qa/validate_external.rb', line 15 def run begin if data.any? ValidateGroups.new(data, nil, collection_name, errors).run ValidateRules.new(data, errors, rules).run if rules end SaveOutput.new(data.count, rules, errors, collection_name, outputs, ).run return errors rescue StandardError => e puts "An error has occurred: #{e}" return nil end end |