Skip to content

Commit

Permalink
Merge pull request #1331 from fluent/add-oj-option-for-2.18.0
Browse files Browse the repository at this point in the history
Make sure to specify use_to_json option
  • Loading branch information
tagomoris authored Nov 28, 2016
2 parents d4313ec + 2008b0d commit 502f858
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/fluent/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module Fluent
DEFAULT_CONFIG_PATH = ENV['FLUENT_CONF'] || '/etc/fluent/fluent.conf'
DEFAULT_PLUGIN_DIR = ENV['FLUENT_PLUGIN'] || '/etc/fluent/plugin'
DEFAULT_SOCKET_PATH = ENV['FLUENT_SOCKET'] || '/var/run/fluent/fluent.sock'
DEFAULT_OJ_OPTIONS = {bigdecimal_load: :float, mode: :compat}
DEFAULT_OJ_OPTIONS = {bigdecimal_load: :float, mode: :compat, use_to_json: true}
IS_WINDOWS = /mswin|mingw/ === RUBY_PLATFORM
private_constant :IS_WINDOWS

Expand Down
4 changes: 3 additions & 1 deletion test/test_event_time.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ class EventTimeTest < Test::Unit::TestCase

test 'Oj.dump' do
time = Fluent::EventTime.new(100)
assert_equal('{"time":100}', Oj.dump({'time' => time}, mode: :compat))
require 'fluent/env'
Oj.default_options = Fluent::DEFAULT_OJ_OPTIONS
assert_equal('{"time":100}', Oj.dump({'time' => time}))
assert_equal('["tag",100,{"key":"value"}]', Oj.dump(["tag", time, {"key" => "value"}], mode: :compat))
end

Expand Down

0 comments on commit 502f858

Please sign in to comment.