Module: HashInitializer
Defined Under Namespace
Classes: InvalidLevels
Instance Method Summary collapse
Instance Method Details
#[](*levels) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/hash_initializer.rb', line 8 def [](*levels) unless levels_okay?(levels) raise InvalidLevels.new('Levels specified are invalid - note that you can only have a non :hash level at the very end') end return {} if levels.empty? defaults_proc = build_levels(levels) Hash.new(&defaults_proc) end |