Sha256: 5d020b7f905cd2a8728e7c3bfc8c871d75de143b795fc0d01e7a327513abf743

Contents?: true

Size: 254 Bytes

Versions: 8

Compression:

Stored size: 254 Bytes

Contents

module ChefAPI
  class Validator::Required < Validator::Base
    def validate(resource)
      value = resource._attributes[attribute]

      if value.to_s.strip.empty?
        resource.errors.add(attribute, "must be present")
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
chef-infra-api-0.10.10 lib/chef-api/validators/required.rb
chef-api-0.10.10 lib/chef-api/validators/required.rb
chef-infra-api-0.10.7 lib/chef-api/validators/required.rb
chef-api-0.10.7 lib/chef-api/validators/required.rb
chef-infra-api-0.10.5 lib/chef-api/validators/required.rb
chef-api-0.10.5 lib/chef-api/validators/required.rb
chef-infra-api-0.10.2 lib/chef-api/validators/required.rb
chef-api-0.10.2 lib/chef-api/validators/required.rb