Module: Xronor::DSL::Checker
- Included in:
- Job
- Defined in:
- lib/xronor/dsl/checker.rb
Defined Under Namespace
Classes: ValidationError
Instance Method Summary collapse
Instance Method Details
#required(name, value) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/xronor/dsl/checker.rb', line 7 def required(name, value) invalid = false if value case value when String invalid = value.strip.empty? when Array, Hash invalid = value.empty? end else invalid = true end raise ValidationError.new("'#{name}' is required") if invalid end |