Module: Interpol::HashFetcher
- Included in:
- DefinitionFinder, Endpoint, EndpointDefinition
- Defined in:
- lib/interpol/endpoint.rb
Overview
Provides a helper method for fetching an item from a hash. Deals with differences on different ruby interpretters.
Instance Method Summary collapse
-
#fetch_from(hash, key) ⇒ Object
Unfortunately, on JRuby 1.9, the error raised from Hash#fetch when the key is not found does not include the key itself :(. So we work around it here..
Instance Method Details
#fetch_from(hash, key) ⇒ Object
Unfortunately, on JRuby 1.9, the error raised from Hash#fetch when the key is not found does not include the key itself :(. So we work around it here.
61 62 63 64 65 |
# File 'lib/interpol/endpoint.rb', line 61 def fetch_from(hash, key) hash.fetch(key) do raise ArgumentError.new("key not found: #{key.inspect}") end end |