Class: FootStats::Stream

Inherits:
Object
  • Object
show all
Defined in:
lib/foot_stats/stream.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#keyObject (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

#payloadObject

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

Returns:

  • (String)


18
19
20
# File 'lib/foot_stats/stream.rb', line 18

def updated?(new_payload)
  payload != new_payload
end