Skip to content

Commit

Permalink
Removed @value_is_set field from Ruby Setting class, using the one fr…
Browse files Browse the repository at this point in the history
…om the wrapped Java Setting class
  • Loading branch information
andsel committed May 27, 2024
1 parent c5e4e28 commit 29748a8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions logstash-core/lib/logstash/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ def initialize(name, klass, default = nil, strict = true, &validator_proc)
@klass = klass
@validator_proc = validator_proc
@value = nil
@value_is_set = false

validate(default) if strict?
@default = default
Expand Down Expand Up @@ -302,7 +301,7 @@ def to_hash
"name" => @wrapped_setting.name,
"klass" => @klass,
"value" => @value,
"value_is_set" => @value_is_set,
"value_is_set" => @wrapped_setting.set?,
"default" => @default,
# Proc#== will only return true if it's the same obj
# so no there's no point in comparing it
Expand All @@ -313,7 +312,7 @@ def to_hash
end

def inspect
"<#{self.class.name}(#{name}): #{value.inspect}" + (@value_is_set ? '' : ' (DEFAULT)') + ">"
"<#{self.class.name}(#{name}): #{value.inspect}" + (@wrapped_setting.set? ? '' : ' (DEFAULT)') + ">"
end

def ==(other)
Expand Down Expand Up @@ -370,7 +369,6 @@ def initialize(name, klass, default = nil, strict = true, &validator_proc)
@klass = klass
@validator_proc = validator_proc
@value = nil
@value_is_set = false

# needed to have the name method accessible when invoking validate
@wrapped_setting = Java::org.logstash.settings.Setting.create(name)
Expand Down Expand Up @@ -821,7 +819,6 @@ def initialize(name, klass, default = nil)
def set(value)
@value = coerce(value)
@wrapped_setting.set(@value)
# @value_is_set = true
@value
end

Expand Down

0 comments on commit 29748a8

Please sign in to comment.