Skip to content

Instantly share code, notes, and snippets.

@westonganger
Created August 31, 2021 03:51
Show Gist options
  • Save westonganger/f6c6743c774025e0aeb1cf09facbb8de to your computer and use it in GitHub Desktop.
Save westonganger/f6c6743c774025e0aeb1cf09facbb8de to your computer and use it in GitHub Desktop.
Ruby FetchHash
################################################## FetchHash - ALL VALUE FETCHING OCCURS USING FETCH METHOD WHICH RAISES ERROR IF KEY NOT FOUND
class FetchHash < HashWithIndifferentAccess
def [](k)
self.fetch(k)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment