Class: Fluent::OjOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/oj_options.rb

Constant Summary collapse

OPTIONS =
{
  'bigdecimal_load': :symbol,
  'mode': :symbol,
  'use_to_json': :bool
}
ALLOWED_VALUES =
{
  'bigdecimal_load': %i[bigdecimal float auto],
  'mode': %i[strict null compat json rails custom]
}
DEFAULTS =
{
  'bigdecimal_load': :float,
  'mode': :compat,
  'use_to_json': true
}
@@available =
false

Class Method Summary collapse

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/fluent/oj_options.rb', line 24

def self.available?
  @@available
end

.load_envObject



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/fluent/oj_options.rb', line 28

def self.load_env
  options = self.get_options
  begin
    require 'oj'
    Oj.default_options = options
    @@available = true
  rescue LoadError
    @@available = false
  end
  options
end