Sha256: f2fa3af8681ec0d64e58677db943e2587174958f08f27d407846525b1dec17c2

Contents?: true

Size: 451 Bytes

Versions: 2

Compression:

Stored size: 451 Bytes

Contents

require 'heart_top/plugin'

class HeartTop::Agent
  PLUGINS = %i(slack)

  def initialize(interval: , verbose: )
    @interval = interval
    @verbose  = verbose
  end

  def run
    while true do
      execute_plugins
      sleep @interval
    end
  end

  private

  def execute_plugins
    puts 'executing ...' if @verbose
    PLUGINS.each do |plugin|
      Object.const_get("HeartTop::Plugin::#{plugin.capitalize}").send('ping')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
heart_top-0.1.1 lib/heart_top/agent.rb
heart_top-0.1.0 lib/heart_top/agent.rb