Sha256: 47c02de402971fe90f8d8e26c7af0f01e509ece416259fa7c7859ed6764f0ff1

Contents?: true

Size: 640 Bytes

Versions: 28

Compression:

Stored size: 640 Bytes

Contents

# Allows a Ruby String to be used to create native Javascript objects
# when calling JSON#generate.
#
# Example:
# JSON.generate({ foo: Rollbar::JSON::Value.new('function(){ alert("bar") }') })
# => '{"foo":function(){ alert(\"bar\") }}'
#
# MUST use the Ruby JSON encoder, as in the example. The ActiveSupport encoder,
# which is installed with Rails, is invoked when calling Hash#to_json and #as_json,
# and will not work.
#
module Rollbar
  module JSON
    class Value # :nodoc:
      attr_accessor :value

      def initialize(value)
        @value = value
      end

      def to_json(*_args)
        value
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
rollbar-3.3.0 lib/rollbar/middleware/js/json_value.rb
rollbar-3.2.0 lib/rollbar/middleware/js/json_value.rb
rollbar-3.1.2 lib/rollbar/middleware/js/json_value.rb
rollbar-3.1.1 lib/rollbar/middleware/js/json_value.rb
rollbar-3.1.0 lib/rollbar/middleware/js/json_value.rb
rollbar-3.0.1 lib/rollbar/middleware/js/json_value.rb
rollbar-3.0.0 lib/rollbar/middleware/js/json_value.rb
rollbar-2.27.1 lib/rollbar/middleware/js/json_value.rb
rollbar-2.27.0 lib/rollbar/middleware/js/json_value.rb
rollbar-2.26.1 lib/rollbar/middleware/js/json_value.rb
rollbar-2.26.0 lib/rollbar/middleware/js/json_value.rb
rollbar-2.25.1 lib/rollbar/middleware/js/json_value.rb
rollbar-2.25.0 lib/rollbar/middleware/js/json_value.rb
rollbar-2.24.0 lib/rollbar/middleware/js/json_value.rb
rollbar-2.23.2 lib/rollbar/middleware/js/json_value.rb
rollbar-2.23.1 lib/rollbar/middleware/js/json_value.rb
rollbar-2.23.0 lib/rollbar/middleware/js/json_value.rb
rollbar-2.22.1 lib/rollbar/middleware/js/json_value.rb
rollbar-2.22.0 lib/rollbar/middleware/js/json_value.rb
rollbar-2.21.0 lib/rollbar/middleware/js/json_value.rb