Class: Megingiard::HashWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/megingiard/hash_wrapper.rb

Overview

Only reveal fetch and translates the Error Message

Instance Method Summary collapse

Constructor Details

#initialize(hash, error_class) ⇒ HashWrapper

Returns a new instance of HashWrapper.



5
6
7
8
# File 'lib/megingiard/hash_wrapper.rb', line 5

def initialize(hash, error_class)
  @hash = hash
  @error_class = error_class
end

Instance Method Details

#fetch(name) ⇒ Object



10
11
12
13
14
# File 'lib/megingiard/hash_wrapper.rb', line 10

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