Sha256: 087a3ce2711537f04d4fe9431c919bf29be6cbcc5ce6dfd9435296adb6e467e7

Contents?: true

Size: 710 Bytes

Versions: 1

Compression:

Stored size: 710 Bytes

Contents

module Timber
  module Probes
    class Heroku < Probe
      class << self
        attr_accessor :inserted
      end

      def initialize
        if dyno.nil?
          raise RequirementNotMetError.new("The DYNO environment variable is not set. " +
            "Not in the Heroku environment.")
        end
      end

      def insert!
        return true if self.class.inserted == true
        context = Contexts::Servers::HerokuSpecific.new(dyno)
        # Note we don't use a block here, this is because
        # the context is persistent.
        CurrentContext.add(context)
        self.class.inserted = true
      end

      private
        def dyno
          ENV['DYNO']
        end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
timberio-1.0.0.beta1 lib/timber/probes/heroku.rb