Sha256: 7aa41ad4d8aae705948173ef8d399ec3fffa3c62aedd4da7cf49080805052023

Contents?: true

Size: 317 Bytes

Versions: 2

Compression:

Stored size: 317 Bytes

Contents

# -*- encoding : utf-8 -*-
module Megingiard
  # Only reveal fetch and translates the Error Message
  class HashWrapper
    def initialize(hash, error_class)
      @hash = hash
      @error_class = error_class
    end

    def fetch(name)
      @hash.fetch(name)
    rescue
      raise @error_class
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
megingiard-0.1.0 lib/megingiard/hash_wrapper.rb
megingiard-0.0.1 lib/megingiard/hash_wrapper.rb