Module: Bootsnap::LoadPathCache::ChangeObserver::ArrayMixin
- Defined in:
- lib/bootsnap/load_path_cache/change_observer.rb
Instance Method Summary collapse
-
#<<(entry) ⇒ Object
For each method that adds items to one end or another of the array (<<, push, unshift, concat), override that method to also notify the observer of the change.
- #concat(entries) ⇒ Object
- #push(*entries) ⇒ Object
-
#uniq!(*args) ⇒ Object
uniq! keeps the first occurrence of each path, otherwise preserving order, preserving the effective load path.
- #unshift(*entries) ⇒ Object
Instance Method Details
#<<(entry) ⇒ Object
For each method that adds items to one end or another of the array (<<, push, unshift, concat), override that method to also notify the observer of the change.
9 10 11 12 |
# File 'lib/bootsnap/load_path_cache/change_observer.rb', line 9 def <<(entry) @lpc_observer.push_paths(self, entry.to_s) super end |
#concat(entries) ⇒ Object
24 25 26 27 |
# File 'lib/bootsnap/load_path_cache/change_observer.rb', line 24 def concat(entries) @lpc_observer.push_paths(self, *entries.map(&:to_s)) super end |
#push(*entries) ⇒ Object
14 15 16 17 |
# File 'lib/bootsnap/load_path_cache/change_observer.rb', line 14 def push(*entries) @lpc_observer.push_paths(self, *entries.map(&:to_s)) super end |
#uniq!(*args) ⇒ Object
uniq! keeps the first occurrence of each path, otherwise preserving order, preserving the effective load path
31 32 33 34 35 |
# File 'lib/bootsnap/load_path_cache/change_observer.rb', line 31 def uniq!(*args) ret = super @lpc_observer.reinitialize if block_given? || !args.empty? ret end |
#unshift(*entries) ⇒ Object
19 20 21 22 |
# File 'lib/bootsnap/load_path_cache/change_observer.rb', line 19 def unshift(*entries) @lpc_observer.unshift_paths(self, *entries.map(&:to_s)) super end |