hashie

https://github.com/hashie/hashie

Ruby

Hashie is a collection of classes and mixins that make Ruby hashes more powerful.

Hashie::Dash.property

Defines a property on the Dash. Options are
as follows:

* <tt>:default</tt> - Specify a default value for this property,
  to be returned before a value is set on the property in a new
  Dash.

* <tt>:required</tt> - Specify the value as required for this
  property, to raise an error if a value is unset in a new or
  existing Dash. If a Proc is provided, it will be run in the
  context of the Dash instance. If a Symbol is provided, the
  property it represents must not be nil. The property is only
  required if the value is truthy.

* <tt>:message</tt> - Specify custom error message for required property

Source | Google | Stack overflow

Edit

git clone [email protected]:hashie/hashie.git

cd hashie

open lib/hashie/dash.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Hashie--Dash-property-for-pr


# Commit to git

git add lib/hashie/dash.rbgit commit -m "better docs for Hashie::Dash.property"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Hashie--Dash-property-for-pr

hub pull-request


# Celebrate!