Class: IB::Datatypes::StringentHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/ib-ruby/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.



392
393
394
395
# File 'lib/ib-ruby/datatypes.rb', line 392

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