Skip to content

Commit

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

@klass = klass
@validator_proc = validator_proc
@value = nil

validate(default) if strict?
@default = default
Expand Down Expand Up @@ -289,7 +288,7 @@ def strict?
def set(value)
validate(value) if strict?
@wrapped_setting.set(value)
@value
@wrapped_setting.value
end

def reset
Expand All @@ -300,7 +299,7 @@ def to_hash
{
"name" => @wrapped_setting.name,
"klass" => @klass,
"value" => @value,
"value" => @wrapped_setting.value,
"value_is_set" => @wrapped_setting.set?,
"default" => @default,
# Proc#== will only return true if it's the same obj
Expand Down Expand Up @@ -368,7 +367,6 @@ def initialize(name, klass, default = nil, strict = true, &validator_proc)

@klass = klass
@validator_proc = validator_proc
@value = nil

# needed to have the name method accessible when invoking validate
@wrapped_setting = Java::org.logstash.settings.Setting.create(name)
Expand Down Expand Up @@ -817,9 +815,9 @@ def initialize(name, klass, default = nil)
end

def set(value)
@value = coerce(value)
@wrapped_setting.set(@value)
@value
coerced_value = coerce(value)
@wrapped_setting.set(coerced_value)
coerced_value
end

def coerce(value)
Expand Down

0 comments on commit e688d12

Please sign in to comment.