Class: AD::Framework::Utilities::Validator
- Inherits:
-
Object
- Object
- AD::Framework::Utilities::Validator
- Defined in:
- lib/ad-framework/utilities/validator.rb
Instance Attribute Summary collapse
-
#entry ⇒ Object
Returns the value of attribute entry.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(entry) ⇒ Validator
constructor
A new instance of Validator.
Constructor Details
#initialize(entry) ⇒ Validator
Returns a new instance of Validator.
8 9 10 |
# File 'lib/ad-framework/utilities/validator.rb', line 8 def initialize(entry) self.entry = entry end |
Instance Attribute Details
#entry ⇒ Object
Returns the value of attribute entry.
6 7 8 |
# File 'lib/ad-framework/utilities/validator.rb', line 6 def entry @entry end |
Instance Method Details
#errors ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/ad-framework/utilities/validator.rb', line 12 def errors self.entry.schema.mandatory.inject({}) do |errors, attribute_name| attribute_type = self.entry.send("#{attribute_name}_attribute_type") if !attribute_type.is_set? errors[attribute_name.to_s] = "was not set" end errors end end |