Class: UffizziCore::EnvironmentVariableListValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- UffizziCore::EnvironmentVariableListValidator
- Defined in:
- app/validators/uffizzi_core/environment_variable_list_validator.rb
Instance Method Summary collapse
Instance Method Details
#valid_variables?(variables) ⇒ Boolean
8 9 10 11 12 13 14 |
# File 'app/validators/uffizzi_core/environment_variable_list_validator.rb', line 8 def valid_variables?(variables) variables.each do |variable| return false if variable.class != Hash || !variable.key?('name') || variable['name'].nil? || !variable.key?('value') end true end |
#validate_each(record, attribute, variables) ⇒ Object
4 5 6 |
# File 'app/validators/uffizzi_core/environment_variable_list_validator.rb', line 4 def validate_each(record, attribute, variables) record.errors.add(attribute, :invalid) if variables.class != Array || !valid_variables?(variables) end |