Class | Hashie::Dash |
In: |
lib/hashie/dash.rb
|
Parent: | Hashie::Hash |
A Dash is a ‘defined’ or ‘discrete’ Hash, that is, a Hash that has a set of defined keys that are accessible (with optional defaults) and only those keys may be set or read.
Dashes are useful when you need to create a very simple lightweight data object that needs even fewer options and resources than something like a DataMapper resource.
It is preferrable to a Struct because of the in-class API for defining properties as well as per-property defaults.
inspect | -> | to_s |
[] | -> | _regular_reader |
_regular_writer | -> | : |
defaults | [R] | |
properties | [R] | |
required_properties | [R] |
You may initialize a Dash with an attributes hash just like you would many other kinds of data objects.