Class: FootStats::Stream
- Inherits:
-
Object
- Object
- FootStats::Stream
- Defined in:
- lib/foot_stats/stream.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
-
#initialize(key) ⇒ Stream
constructor
A new instance of Stream.
-
#payload ⇒ Object
Access payload store.
-
#store(value) ⇒ Object
Stores latest payload.
-
#updated?(new_payload) ⇒ String
Verifies if payload is up-to-date.
Constructor Details
#initialize(key) ⇒ Stream
Returns a new instance of Stream.
5 6 7 |
# File 'lib/foot_stats/stream.rb', line 5 def initialize(key) @key = key end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
3 4 5 |
# File 'lib/foot_stats/stream.rb', line 3 def key @key end |
Instance Method Details
#payload ⇒ Object
Access payload store
23 24 25 |
# File 'lib/foot_stats/stream.rb', line 23 def payload payload_store[@key] end |
#store(value) ⇒ Object
Stores latest payload
10 11 12 |
# File 'lib/foot_stats/stream.rb', line 10 def store(value) payload_store[@key] = value end |
#updated?(new_payload) ⇒ String
Verifies if payload is up-to-date
18 19 20 |
# File 'lib/foot_stats/stream.rb', line 18 def updated?(new_payload) payload != new_payload end |