Sha256: d5046b06047b3059c3de9a1ed01c5d89661ae5d3aa316f4e81b28482238d83ce

Contents?: true

Size: 605 Bytes

Versions: 3

Compression:

Stored size: 605 Bytes

Contents

# frozen_string_literal: true

class Revector
  module Contains
    def self.check!(item, iteratee, value)
      fetched_value = Utility::TryFetchOrBlank[item, iteratee]
      return false unless fetched_value

      compare(fetched_value, value)
    end

    def self.compare(fetched_value, value)
      Array(value).any? { |v| fetched_value.to_s.match(/#{v}/) }
    end
  end

  module NotContains
    def self.check!(item, iteratee, value)
      !Contains.check!(item, iteratee, value)
    end

    def self.compare(fetched_value, value)
      !Contains.compare(fetched_value, value)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
revector-0.1.2 lib/revector/predicate/contains.rb
revector-0.1.1 lib/revector/predicate/contains.rb
revector-0.1.0 lib/revector/predicate/contains.rb