Sha256: 291cd3eeb3b869290ee4e5ff4268bc95cac969856045d9e42225346cf56a9a89

Contents?: true

Size: 815 Bytes

Versions: 4

Compression:

Stored size: 815 Bytes

Contents

module Rollbar
  module LanguageSupport
    module_function

    def const_defined?(mod, target, inherit = true)
      if ruby_18?
        mod.const_defined?(target)
      else
        mod.const_defined?(target, inherit)
      end
    end

    def const_get(mod, target, inherit = true)
      if ruby_18?
        mod.const_get(target)
      else
        mod.const_get(target, inherit)
      end
    end

    def can_scrub_url?
      !version?('1.8')
    end

    def ruby_18?
      version?('1.8')
    end

    def ruby_19?
      version?('1.9')
    end

    def version?(version)
      numbers = version.split('.')

      numbers == ::RUBY_VERSION.split('.')[0, numbers.size]
    end

    def timeout_exceptions
      return [] if ruby_18? || ruby_19?

      [Net::ReadTimeout, Net::OpenTimeout]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rollbar-2.20.1 lib/rollbar/language_support.rb
rollbar-2.20.0 lib/rollbar/language_support.rb
rollbar-2.19.4 lib/rollbar/language_support.rb
rollbar-2.19.3 lib/rollbar/language_support.rb