module Hashie::Extensions::StrictKeyAccess

SRP: This extension will fail an error whenever a key is accessed

that does not exist in the hash.

EXAMPLE:

  class StrictKeyAccessHash < Hash
    include Hashie::Extensions::StrictKeyAccess
  end

  >> hash = StrictKeyAccessHash[foo: "bar"]
  => {:foo=>"bar"}
  >> hash[:foo]
  => "bar"
  >> hash[:cow]
    KeyError: key not found: :cow

NOTE: For googlers coming from Python to Ruby, this extension makes a Hash behave more like a “Dictionary”.