Class: Whisper::TimedMap
- Inherits:
-
Object
show all
- Includes:
- Loggy
- Defined in:
- lib/whisper/timed_map.rb
Class Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of TimedMap.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *a) ⇒ Object
40
|
# File 'lib/whisper/timed_map.rb', line 40
def method_missing(m, *a); @h.send(m, *a) end
|
Class Attribute Details
.expiration_interval ⇒ Object
Returns the value of attribute expiration_interval.
7
8
9
|
# File 'lib/whisper/timed_map.rb', line 7
def expiration_interval
@expiration_interval
end
|
Instance Method Details
#[](k) ⇒ Object
19
20
21
|
# File 'lib/whisper/timed_map.rb', line 19
def [] k
@h[k] && @h[k][0]
end
|
#[]=(k, v) ⇒ Object
15
16
17
|
# File 'lib/whisper/timed_map.rb', line 15
def []= k, v
@h[k] = [v, Time.now]; v
end
|
#each ⇒ Object
23
24
25
|
# File 'lib/whisper/timed_map.rb', line 23
def each
@h.each { |k, (a, b)| yield k, a }
end
|
#values ⇒ Object
27
28
29
|
# File 'lib/whisper/timed_map.rb', line 27
def values
@h.values.map { |a, b| a }
end
|