Module: SF6::Limiter

Defined in:
lib/sf6.rb

Class Method Summary collapse

Class Method Details

.check(attr, value, bucket, &blk) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/sf6.rb', line 31

def self.check(attr, value, bucket, &blk)
  timestamp = SF6.stamp(data, attr, bucket)
  SF6.increment(data, attr, timestamp)
  SF6.test(data, attr, value) do
    yield
  end
end

.dataObject



27
28
29
# File 'lib/sf6.rb', line 27

def self.data
  @data ||= {counts: Hash.new(0), timestamps: Hash.new(0)}
end