Method: DataMapper::Validations::OrderedHash#initialize
- Defined in:
- lib/dm-validations/support/ordered_hash.rb
#initialize(*args, &blk) ⇒ OrderedHash
New Dictiionary.
136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/dm-validations/support/ordered_hash.rb', line 136 def initialize(*args, &blk) @order = [] @order_by = nil if blk dict = self # This ensure autmatic key entry effect the oblk = lambda{ |hsh, key| blk[dict,key] } # dictionary rather then just the interal hash. @hash = Hash.new(*args, &oblk) else @hash = Hash.new(*args) end end |