Sha256: 8d8a8218e71d65900505ddcd69208a9add11188d9b8d449b3022b9d13d773af9

Contents?: true

Size: 632 Bytes

Versions: 77

Compression:

Stored size: 632 Bytes

Contents

module Rollbar
  module Encoding
    class << self
      attr_accessor :encoding_class
    end

    def self.setup
      if String.instance_methods.include?(:encode)
        require 'rollbar/encoding/encoder'
        self.encoding_class = Rollbar::Encoding::Encoder
      else
        require 'rollbar/encoding/legacy_encoder'
        self.encoding_class = Rollbar::Encoding::LegacyEncoder
      end
    end

    def self.encode(object)
      can_be_encoded = object.is_a?(String) || object.is_a?(Symbol)

      return object unless can_be_encoded

      encoding_class.new(object).encode
    end
  end
end

Rollbar::Encoding.setup

Version data entries

77 entries across 77 versions & 1 rubygems

Version Path
rollbar-2.9.0 lib/rollbar/encoding.rb
rollbar-2.8.3 lib/rollbar/encoding.rb
rollbar-2.8.2 lib/rollbar/encoding.rb
rollbar-2.8.1 lib/rollbar/encoding.rb
rollbar-2.8.0 lib/rollbar/encoding.rb
rollbar-2.7.1 lib/rollbar/encoding.rb
rollbar-2.7.0 lib/rollbar/encoding.rb
rollbar-2.6.3 lib/rollbar/encoding.rb
rollbar-2.6.2 lib/rollbar/encoding.rb
rollbar-2.6.1 lib/rollbar/encoding.rb
rollbar-2.6.0 lib/rollbar/encoding.rb
rollbar-2.5.2 lib/rollbar/encoding.rb
rollbar-2.5.1 lib/rollbar/encoding.rb
rollbar-2.5.0 lib/rollbar/encoding.rb
rollbar-2.4.0 lib/rollbar/encoding.rb
rollbar-2.3.0 lib/rollbar/encoding.rb
rollbar-2.2.1 lib/rollbar/encoding.rb