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.15.4 lib/rollbar/encoding.rb
rollbar-2.15.3 lib/rollbar/encoding.rb
rollbar-2.15.2 lib/rollbar/encoding.rb
rollbar-2.15.1 lib/rollbar/encoding.rb
rollbar-2.15.0 lib/rollbar/encoding.rb
rollbar-2.14.1 lib/rollbar/encoding.rb
rollbar-2.14.0 lib/rollbar/encoding.rb
rollbar-2.13.3 lib/rollbar/encoding.rb
rollbar-2.13.2 lib/rollbar/encoding.rb
rollbar-2.13.1 lib/rollbar/encoding.rb
rollbar-2.13.0 lib/rollbar/encoding.rb
rollbar-2.12.0 lib/rollbar/encoding.rb
rollbar-2.11.5 lib/rollbar/encoding.rb
rollbar-2.11.4 lib/rollbar/encoding.rb
rollbar-2.11.3 lib/rollbar/encoding.rb
rollbar-2.11.2 lib/rollbar/encoding.rb
rollbar-2.11.1 lib/rollbar/encoding.rb
rollbar-2.11.0 lib/rollbar/encoding.rb
rollbar-2.10.0 lib/rollbar/encoding.rb
rollbar-2.9.1 lib/rollbar/encoding.rb