Method: Webhookdb::Json::Encoder#stringify

Defined in:
lib/webhookdb/json.rb

#stringify(jsonified) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
# File 'lib/webhookdb/json.rb', line 73

def stringify(jsonified)
  # If this breaks because we actually need to handle more types,
  # add them to jsonify, like Rational.
  #
  # We can't use `mode: :rails` here since we can't control
  # whether to use html-escaping (we don't want to use it) without using `Oj.optimize_rails`,
  # which causes other problems- we want to use ISO8601 encoding with millsecond precision,
  # but we get JSON-gem-style formatting (even if setting flags to modify ActiveSupport params)
  # when we use `optimize-rails` (but not mode: :rails, since we stringify the time beforehand).
  return ::Oj.dump(jsonified, mode: :strict, **@options)
end