Sha256: 9dfe1992c0e61c8346267f52e23106382c66b25559e0fd567bc536ec2ba8a293
Contents?: true
Size: 905 Bytes
Versions: 12
Compression:
Stored size: 905 Bytes
Contents
# frozen_string_literal: true module SplitIoClient class LessThanOrEqualToSemverMatcher < Matcher MATCHER_TYPE = 'LESS_THAN_OR_EQUAL_TO_SEMVER' attr_reader :attribute def initialize(attribute, string_value, logger, validator) super(logger) @validator = validator @attribute = attribute @semver = SplitIoClient::Semver.build(string_value, logger) @logger = logger end def match?(args) return false unless verify_semver_arg?(args, 'LessThanOrEqualsToSemverMatcher') value_to_match = SplitIoClient::Semver.build(args[:attributes][@attribute.to_sym], @logger) return false unless check_semver_value_to_match(value_to_match, MATCHER_TYPE) matches = [0, -1].include?(value_to_match.compare(@semver)) @logger.debug("[LessThanOrEqualsToSemverMatcher] #{value_to_match} matches -> #{matches}") matches end end end
Version data entries
12 entries across 12 versions & 1 rubygems