Class: Burninator

Inherits:
Object
  • Object
show all
Defined in:
lib/burninator.rb,
lib/burninator/warmer.rb,
lib/burninator/connection.rb,
lib/burninator/broadcaster.rb

Defined Under Namespace

Classes: Broadcaster, Connection, Tasks, Warmer

Constant Summary collapse

DEFAULT_PERCENTAGE =
5
EnvironmentError =
Class.new(ArgumentError)

Instance Method Summary collapse

Constructor Details

#initialize(redis = nil) ⇒ Burninator

Returns a new instance of Burninator.



11
12
13
# File 'lib/burninator.rb', line 11

def initialize(redis = nil)
  @redis = redis
end

Instance Method Details

#broadcast(options = {}) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/burninator.rb', line 19

def broadcast(options = {})
  broadcaster = Burninator::Broadcaster.new(redis, channel,
    percentage: options.fetch(:percentage, DEFAULT_PERCENTAGE),
    ignore: options[:ignore]
  )

  broadcaster.run
end

#channelObject



28
29
30
# File 'lib/burninator.rb', line 28

def channel
  ["burninator", database_id].join(":")
end

#warmObject



15
16
17
# File 'lib/burninator.rb', line 15

def warm
  Burninator::Warmer.new(redis, channel, database).run
end