chef
https://github.com/opscode/chef
Ruby
A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure.
Chef::Property#explicitly_accepts_nil?
Find out whether this type accepts nil explicitly.
A type accepts nil explicitly if "is" allows nil, it validates as nil, *and* is not simply
an empty type.
A type is presumed to accept nil if it does coercion (which must handle nil).
These examples accept nil explicitly:
```ruby
property :a, [ String, nil ]
property :a, [ String, NilClass ]
property :a, [ String, proc { |v| v.nil? } ]
```
This does not (because the "is" doesn't exist or doesn't have nil):
```ruby
property :x, String
```
These do not, even though nil would validate fine (because they do not
have "is"):
```ruby
property :a
property :a, equal_to: [ 1, 2, 3, nil ]
property :a, kind_of: [ String, NilClass ]
property :a, respond_to: [ ]
property :a, callbacks: { "a" => proc { |v| v.nil? } }
```Edit
git clone [email protected]:opscode/chef.git
cd chef
open lib/chef/property.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Chef--Property-explicitly_accepts_nil--for-pr
# Commit to gitgit add lib/chef/property.rbgit commit -m "better docs for Chef::Property#explicitly_accepts_nil?"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Chef--Property-explicitly_accepts_nil--for-pr
hub pull-request
# Celebrate!