Sha256: dc251d8b9f9ce1e65c8c6f0dd0e4aa10f3f3aa6e821b9965d3dbc693b66187e0

Contents?: true

Size: 844 Bytes

Versions: 1

Compression:

Stored size: 844 Bytes

Contents

# frozen_string_literal: true

require 'rollbar'

require 'rollbar/mode/local_notifier'
require 'rollbar/mode/production'
require 'rollbar/mode/development'

require 'rollbar/mode/version'

module Rollbar
  # Minor mode for Rollbar
  module Mode

    def self.apply
      if Rollbar::Mode.production?
        Rollbar::Mode::Production.apply
      else
        Rollbar::Mode::Development.apply
      end
    end

    def self.production?
      Rollbar::Mode::Production.access_token ||
        Rollbar.configuration.enabled
    end

    # Determine if the current environment is a Heroku dyno based on the
    # dyno metadata.
    #
    # See:
    #
    # https://devcenter.heroku.com/articles/dyno-metadata
    def self.heroku?
      ENV.key?('HEROKU_SLUG_COMMIT') &&
        ENV.key?('HEROKU_APP_NAME')
    end

  end
end

Rollbar::Mode.apply

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rollbar-mode-0.0.1 lib/rollbar/mode.rb