Class: Sworn::ReplayProtector::Memory

Inherits:
Object
  • Object
show all
Defined in:
lib/sworn/replay_protector/memory.rb

Instance Method Summary collapse

Constructor Details

#initialize(*options) ⇒ Memory

Returns a new instance of Memory.



4
5
6
# File 'lib/sworn/replay_protector/memory.rb', line 4

def initialize(*options)
  @store ||= Set.new
end

Instance Method Details

#replayed?(oauth) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
# File 'lib/sworn/replay_protector/memory.rb', line 8

def replayed?(oauth)
  return true if @store.include?(oauth)
  @store << oauth
  false
end