Sha256: e1087dc13873233125d319e23731e7c8549e751c5aba15ceff99052b89ea2a39

Contents?: true

Size: 750 Bytes

Versions: 1

Compression:

Stored size: 750 Bytes

Contents

require 'stack-agent/configuration'
require 'stack-agent/instance'

module StackAgent
  VERSION = '0.1.3'

  class << self
    attr_writer :configuration
  end

  def self.configuration
    @configuration ||= StackAgent::Configuration.new
  end

  def self.reset
    @configuration = StackAgent::Configuration.new
  end

  def self.configure
    yield(configuration)
  end

  def self.register
    @instance = StackAgent::Instance.new
    puts "Registered Stack #{@instance.instance_token}" if @instance.register
  end

  def self.unregister
    return false unless @instance
    puts "Unregistered Stack #{@instance.instance_token}" if @instance.unregister
  end

  def self.connect!
    register

    at_exit do
      unregister
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stack-agent-0.1.3 lib/stack-agent.rb