Sha256: 1d836f6461a5f1d3252b56255c9852e0c01b756ba3a4914783f476954907b897

Contents?: true

Size: 254 Bytes

Versions: 14

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

14 entries across 14 versions & 2 rubygems

Version Path
chef-infra-api-0.10.0 lib/chef-api/validators/required.rb
chef-api-0.10.0 lib/chef-api/validators/required.rb
chef-infra-api-0.9.1 lib/chef-api/validators/required.rb
chef-api-0.9.0 lib/chef-api/validators/required.rb
chef-api-0.8.0 lib/chef-api/validators/required.rb
chef-api-0.7.1 lib/chef-api/validators/required.rb
chef-api-0.7.0 lib/chef-api/validators/required.rb
chef-api-0.6.0 lib/chef-api/validators/required.rb
chef-api-0.5.0 lib/chef-api/validators/required.rb
chef-api-0.4.1 lib/chef-api/validators/required.rb
chef-api-0.4.0 lib/chef-api/validators/required.rb
chef-api-0.3.0 lib/chef-api/validators/required.rb
chef-api-0.2.1 lib/chef-api/validators/required.rb
chef-api-0.2.0 lib/chef-api/validators/required.rb