Skip to content

Commit

Permalink
Show correct default value on dumping a config element
Browse files Browse the repository at this point in the history
Signed-off-by: Takuro Ashie <ashie@clear-code.com>
  • Loading branch information
ashie committed Dec 5, 2019
1 parent 45adea3 commit f13d48b
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions lib/fluent/config/element.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,24 +182,27 @@ def secret_param?(key)
false
end

def options(key)
return {} if @corresponding_proxies.empty?
def param_type(key)
return nil if @corresponding_proxies.empty?

param_key = key.to_sym
proxy = @corresponding_proxies.detect do |_proxy|
_proxy.params.has_key?(param_key)
end
return {} unless proxy
return nil unless proxy
_block, opts = proxy.params[param_key]
opts
end

def param_type(key)
options(key)[:type]
opts[:type]
end

def default_value(key)
options(key)[:default]
return nil if @corresponding_proxies.empty?

param_key = key.to_sym
proxy = @corresponding_proxies.detect do |_proxy|
_proxy.params.has_key?(param_key)
end
return nil unless proxy
proxy.defaults[param_key]
end

def dump_value(k, v, nindent)
Expand Down

0 comments on commit f13d48b

Please sign in to comment.