Class: Observed::Hash::Fetcher
- Inherits:
-
Object
- Object
- Observed::Hash::Fetcher
- Includes:
- KeyPathEncoding
- Defined in:
- lib/observed/hash/fetcher.rb
Instance Method Summary collapse
- #[](key_path) ⇒ Object
-
#initialize(hash) ⇒ Fetcher
constructor
A new instance of Fetcher.
Methods included from KeyPathEncoding
Constructor Details
#initialize(hash) ⇒ Fetcher
Returns a new instance of Fetcher.
8 9 10 |
# File 'lib/observed/hash/fetcher.rb', line 8 def initialize(hash) @hash = hash || fail('The hash must not be nil') end |
Instance Method Details
#[](key_path) ⇒ Object
12 13 14 15 16 |
# File 'lib/observed/hash/fetcher.rb', line 12 def [](key_path) at_key_path_on_hash @hash, key_path, create_if_missing: false do |h, k| h[k] end end |