Method: Sequence::OfHash#initialize
- Defined in:
- lib/sequence/ofhash.rb
#initialize(hash, exceptions = [], include_default = false, modifiable = false) ⇒ OfHash
Returns a new instance of OfHash.
8 9 10 11 12 13 14 15 |
# File 'lib/sequence/ofhash.rb', line 8 def initialize(hash,exceptions=[],include_default=false,modifiable=false) @hash=hash hash=hash.dup exceptions.each{|exc| hash.delete exc } @data=hash.inject([]){|l,pair| l+pair} @data<<hash.default if include_default @data.freeze unless modifiable end |