Module: Lazier::Hash
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/lazier/hash.rb
Overview
Extensions for Hash objects.
Instance Method Summary (collapse)
-
- (Object) ensure_access(access)
Makes sure that the keys of the hash are accessible in the desired way.
Instance Method Details
- (Object) ensure_access(access)
Makes sure that the keys of the hash are accessible in the desired way.
15 16 17 18 |
# File 'lib/lazier/hash.rb', line 15 def ensure_access(access) method = {strings: :stringify_keys, symbols: :symbolize_keys, indifferent: :with_indifferent_access}.fetch(access, nil) method ? send(method) : self end |