Class: IB::Datatypes::StringentHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/legacy/datatypes.rb

Overview

Just like a Hash, but throws an exception if you try to access a key that doesn’t exist.

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ StringentHash

Returns a new instance of StringentHash.



476
477
478
479
# File 'lib/legacy/datatypes.rb', line 476

def initialize(hash)
  super() { |hash, key| raise Exception.new("key #{key.inspect} not found!") }
  self.merge!(hash) unless hash.nil?
end