Class: Staypuft::Deployment::NeutronService::Cisconexus::PortMapValueValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- Staypuft::Deployment::NeutronService::Cisconexus::PortMapValueValidator
- Defined in:
- app/models/staypuft/deployment/neutron_service/cisconexus.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'app/models/staypuft/deployment/neutron_service/cisconexus.rb', line 36 def validate_each(record, attribute, value) return if value.empty? if value.each_line.collect { |line| line.split(':').count == 2 }.all? true else record.errors.add attribute, "One per line, 'hostname: port'" false end end |