Sha256: 652c6317f0abb306504796d37d02568150b340546a7de589dac01720fbf8006a

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.1'

  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.1 lib/stack-agent.rb