Class: Rollbar::JSON::Value

Inherits:
Object
  • Object
show all
Defined in:
lib/rollbar/middleware/js/json_value.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Value

Returns a new instance of Value.



23
24
25
# File 'lib/rollbar/middleware/js/json_value.rb', line 23

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



21
22
23
# File 'lib/rollbar/middleware/js/json_value.rb', line 21

def value
  @value
end

Instance Method Details

#to_json(opts = {}) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/rollbar/middleware/js/json_value.rb', line 27

def to_json(opts = {})
  # Return the raw value if this is from the js middleware
  return value if opts.class == Rollbar::JSON::JsOptionsState

  # Otherwise convert to a string
  %Q["#{value}"]
end