Sha256: cf6e361bfffed9cd372da5ee85c8f07f0f3ca934e156bcd65b0bdff5f3774ae7

Contents?: true

Size: 1.62 KB

Versions: 12

Compression:

Stored size: 1.62 KB

Contents

require "yaml"

begin
  if Appsignal::System.jruby?
    require "appsignal/extension/jruby"
    # {Appsignal.extension_loaded} is set in the JRuby extension file
  else
    require "appsignal_extension"
    Appsignal.extension_loaded = true
  end
rescue LoadError => err
  Appsignal.logger.error(
    "Failed to load extension (#{err}), please check the install.log file in " \
    "the ext directory of the gem and email us at support@appsignal.com"
  )
  Appsignal.extension_loaded = false
end

module Appsignal
  # @api private
  class Extension
    class << self
      def agent_config
        @agent_config ||= YAML.load(
          File.read(File.join(File.dirname(__FILE__), "../../ext/agent.yml"))
        )
      end

      def agent_version
        agent_config["version"]
      end

      # Do nothing if the extension methods are not loaded
      #
      # Disabled in testing so we can make sure that we don't miss a extension
      # function implementation.
      def method_missing(m, *args, &block)
        super if Appsignal.testing?
      end
    end

    if Appsignal::System.jruby?
      extend Appsignal::Extension::Jruby

      # Reassign Transaction class for JRuby extension usage.
      #
      # Makes sure the generated docs aren't always overwritten with the JRuby
      # version.
      Transaction = Jruby::Transaction
      # Reassign Data class for JRuby extension usage.
      #
      # Makes sure the generated docs aren't always overwritten with the JRuby
      # version.
      Data = Jruby::Data
    end

    class Data
      def inspect
        "#<#{self.class.name}:#{object_id} #{self}>"
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
appsignal-2.5.3-java lib/appsignal/extension.rb
appsignal-2.5.3 lib/appsignal/extension.rb
appsignal-2.5.3.alpha.2 lib/appsignal/extension.rb
appsignal-2.5.3.alpha.2-java lib/appsignal/extension.rb
appsignal-2.5.3.alpha.1 lib/appsignal/extension.rb
appsignal-2.5.3.alpha.1-java lib/appsignal/extension.rb
appsignal-2.5.2-java lib/appsignal/extension.rb
appsignal-2.5.2 lib/appsignal/extension.rb
appsignal-2.5.1-java lib/appsignal/extension.rb
appsignal-2.5.1 lib/appsignal/extension.rb
appsignal-2.5.1.beta.1-java lib/appsignal/extension.rb
appsignal-2.5.1.beta.1 lib/appsignal/extension.rb