Sha256: cb3f42ceff4b857c5c0bc6fba4e7c66d3e9e3e88bc8e79c3dd3a79f92aa57cff
Contents?: true
Size: 796 Bytes
Versions: 28
Compression:
Stored size: 796 Bytes
Contents
# frozen_string_literal: true module SplitIoClient class EqualToBooleanMatcher MATCHER_TYPE = 'EQUAL_TO_BOOLEAN' attr_reader :attribute def initialize(attribute, boolean) @attribute = attribute @boolean = boolean end def match?(args) value = get_value(args) value = false if value.to_s.casecmp('false').zero? value = true if value.to_s.casecmp('true').zero? matches = value == @boolean SplitLogger.log_if_debug("[EqualToBooleanMatcher] #{value} equals to #{@boolean} -> #{matches}") matches end def string_type? false end private def get_value(args) args[:attributes].fetch(@attribute) do |a| args[:attributes][a.to_s] || args[:attributes][a.to_sym] end end end end
Version data entries
28 entries across 28 versions & 1 rubygems