Class: DeepCover::TrackerStoragePerPath
- Inherits:
-
Object
- Object
- DeepCover::TrackerStoragePerPath
- Extended by:
- Forwardable
- Defined in:
- lib/deep_cover/tracker_storage_per_path.rb
Overview
Should be seen as a hash like => tracker_storage, … Make it easier to separate some concerns, as well as marshalling
Instance Attribute Summary collapse
-
#bucket ⇒ Object
readonly
Returns the value of attribute bucket.
Instance Method Summary collapse
- #[](path) ⇒ Object
-
#initialize(bucket) ⇒ TrackerStoragePerPath
constructor
A new instance of TrackerStoragePerPath.
- #tracker_hits_per_path ⇒ Object
- #tracker_hits_per_path=(tracker_hits_per_path) ⇒ Object
Constructor Details
#initialize(bucket) ⇒ TrackerStoragePerPath
Returns a new instance of TrackerStoragePerPath.
15 16 17 18 |
# File 'lib/deep_cover/tracker_storage_per_path.rb', line 15 def initialize(bucket) @bucket = bucket @index = {} end |
Instance Attribute Details
#bucket ⇒ Object (readonly)
Returns the value of attribute bucket.
13 14 15 |
# File 'lib/deep_cover/tracker_storage_per_path.rb', line 13 def bucket @bucket end |
Instance Method Details
#[](path) ⇒ Object
20 21 22 |
# File 'lib/deep_cover/tracker_storage_per_path.rb', line 20 def [](path) @index[path] ||= @bucket.create_storage end |
#tracker_hits_per_path ⇒ Object
24 25 26 |
# File 'lib/deep_cover/tracker_storage_per_path.rb', line 24 def tracker_hits_per_path TrackerHitsPerPath.new(@index.transform_values(&:tracker_hits)) end |
#tracker_hits_per_path=(tracker_hits_per_path) ⇒ Object
28 29 30 31 32 |
# File 'lib/deep_cover/tracker_storage_per_path.rb', line 28 def tracker_hits_per_path=(tracker_hits_per_path) tracker_hits_per_path.each do |path, tracker_hits| self[path].tracker_hits = tracker_hits end end |