class Mengpaneel::Flusher

Constants

STRATEGIES

Attributes

manager[R]

Public Class Methods

new(manager) click to toggle source
# File lib/mengpaneel/flusher.rb, line 19
def initialize(manager)
  @manager = manager
end

Public Instance Methods

run() click to toggle source
# File lib/mengpaneel/flusher.rb, line 23
def run
  return unless Mengpaneel.token
  
  if manager.flushing_strategy
    strategy = Strategy.const_get(manager.flushing_strategy.to_s.classify)
    flush_using(strategy)
  else
    STRATEGIES.find { |strategy| flush_using(strategy) }
  end
end

Private Instance Methods

flush_using(strategy) click to toggle source
# File lib/mengpaneel/flusher.rb, line 35
def flush_using(strategy)
  strategy.new(manager.all_calls, manager.controller).run
end