Skip to content

Commit 61b8c9e

Browse files
author
Bilal Al
committed
fixed condition
1 parent dc0caa6 commit 61b8c9e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/splitclient-rb/engine/matchers/greater_than_or_equal_to_semver_matcher.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ def initialize(attribute, string_value, logger, validator)
1010
super(logger)
1111
@validator = validator
1212
@attribute = attribute
13-
@semver = SplitIoClient::Semver.new(string_value)
13+
@semver = SplitIoClient::Semver.build(string_value, logger)
1414
@logger = logger
1515
end
1616

1717
def match?(args)
1818
@logger.log_if_debug('[GreaterThanOrEqualsToSemverMatcher] evaluating value and attributes.')
19-
return false unless @validator.valid_matcher_arguments(args)
19+
return false unless @validator.valid_matcher_arguments(args) && args[:attributes][@attribute.to_sym].is_a?(String)
2020

21-
value_to_match = args[:attributes][@attribute.to_sym]
22-
unless value_to_match.is_a?(String)
21+
value_to_match = SplitIoClient::Semver.build(args[:attributes][@attribute.to_sym], @logger)
22+
unless !value_to_match.nil? && !@semver.nil?
2323
@logger.log_if_debug('stringMatcherData is required for GREATER_THAN_OR_EQUAL_TO_SEMVER matcher type')
2424
return false
2525
end
26-
matches = [0, 1].include?(SplitIoClient::Semver.new(value_to_match).compare(@semver))
26+
matches = [0, 1].include?(value_to_match.compare(@semver))
2727
@logger.log_if_debug("[GreaterThanOrEqualsToSemverMatcher] #{value_to_match} matches -> #{matches}")
2828
matches
2929
end

0 commit comments

Comments
 (0)