Module: Pulsar::Validator
- Included in:
- AddApplications, Cleanup, CloneRepository, CopyEnvironmentFile, CopyInitialRepository, CreateCapfile, CreateDeployFile, CreateRunDirs, IdentifyRepositoryLocation, IdentifyRepositoryType, RunBundleInstall, RunCapistrano
- Defined in:
- lib/pulsar/validator.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
3 4 5 6 |
# File 'lib/pulsar/validator.rb', line 3 def self.included(klass) klass.extend ClassMethods klass.before :validate_context! end |
Instance Method Details
#context_fail!(msg) ⇒ Object
15 16 17 |
# File 'lib/pulsar/validator.rb', line 15 def context_fail!(msg) context.fail! error: Pulsar::ContextError.new(msg) end |
#validable_properties ⇒ Object
19 20 21 |
# File 'lib/pulsar/validator.rb', line 19 def validable_properties self.class.validable_properties end |
#validate_context! ⇒ Object
8 9 10 11 12 13 |
# File 'lib/pulsar/validator.rb', line 8 def validate_context! validable_properties.each do |property| result = context.send property.to_sym context_fail! "Invalid context for #{property} [#{result}]" unless result end end |