Sha256: 6a55e2e67d7858ffac44a90a6ed5d5ce5ee7a455637dbb7dfff9dd63772ae0f6
Contents?: true
Size: 601 Bytes
Versions: 13
Compression:
Stored size: 601 Bytes
Contents
# frozen_string_literal: true module DocTemplate class XpathFunctions def case_insensitive_equals(node_set, str_to_match) return node_set.to_s.squish.casecmp(str_to_match).zero? if node_set.is_a?(String) node_set.find_all { |node| node.to_s.squish.casecmp(str_to_match).zero? } end def case_insensitive_contains(node_set, str_to_match) node_set.find_all { |node| node.to_s.downcase.include?(str_to_match.to_s.downcase) } end def case_regular(node_set, re_to_match) node_set.to_s.match?(Regexp.new(re_to_match, true)) ? node_set : [] end end end
Version data entries
13 entries across 13 versions & 1 rubygems