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-3.3.3 lib/rollbar/encoding.rb
rollbar-3.3.2 lib/rollbar/encoding.rb
rollbar-3.3.1 lib/rollbar/encoding.rb
rollbar-3.3.0 lib/rollbar/encoding.rb
rollbar-3.2.0 lib/rollbar/encoding.rb
rollbar-3.1.2 lib/rollbar/encoding.rb
rollbar-3.1.1 lib/rollbar/encoding.rb
rollbar-3.1.0 lib/rollbar/encoding.rb
rollbar-3.0.1 lib/rollbar/encoding.rb
rollbar-3.0.0 lib/rollbar/encoding.rb
rollbar-2.27.1 lib/rollbar/encoding.rb
rollbar-2.27.0 lib/rollbar/encoding.rb
rollbar-2.26.1 lib/rollbar/encoding.rb
rollbar-2.26.0 lib/rollbar/encoding.rb
rollbar-2.25.1 lib/rollbar/encoding.rb
rollbar-2.25.0 lib/rollbar/encoding.rb
rollbar-2.24.0 lib/rollbar/encoding.rb
rollbar-2.23.2 lib/rollbar/encoding.rb
rollbar-2.23.1 lib/rollbar/encoding.rb
rollbar-2.23.0 lib/rollbar/encoding.rb