Class: Castle::Validators::Present

Inherits:
Object
  • Object
show all
Defined in:
lib/castle/validators/present.rb

Overview

Checks if required keys are present

Class Method Summary collapse

Class Method Details

.call(options, keys) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/castle/validators/present.rb', line 8

def call(options, keys)
  keys.each do |key|
    next unless options[key].to_s.empty?

    raise Castle::InvalidParametersError, "#{key} is missing or empty"
  end
end