Method: ChefAPI::Validator::Type#validate
- Defined in:
- lib/chef-api/validators/type.rb
#validate(resource) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/chef-api/validators/type.rb', line 14 def validate(resource) value = resource._attributes[attribute] if value && !types.any? { |type| value.is_a?(type) } short_name = type.to_s.split('::').last resource.errors.add(attribute, "must be a kind of #{short_name}") end end |