class Fluent::OjOptions
Constants
- ALLOWED_VALUES
- DEFAULTS
- OPTIONS
Public Class Methods
available?()
click to toggle source
# File lib/fluent/oj_options.rb, line 24 def self.available? @@available end
load_env()
click to toggle source
# 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
Private Class Methods
get_options()
click to toggle source
# File lib/fluent/oj_options.rb, line 42 def self.get_options options = {} DEFAULTS.each { |key, value| options[key] = value } OPTIONS.each do |key, type| env_value = ENV["FLUENT_OJ_OPTION_#{key.upcase}"] next if env_value.nil? cast_value = Fluent::Config.reformatted_value(OPTIONS[key], env_value, { strict: true }) next if cast_value.nil? next if ALLOWED_VALUES[key] && !ALLOWED_VALUES[key].include?(cast_value) options[key.to_sym] = cast_value end options end