Sha256: b6d767e7662b01777dce4069823738a029fa45872f4953cfad2949fc2c0d2400

Contents?: true

Size: 505 Bytes

Versions: 3

Compression:

Stored size: 505 Bytes

Contents

# frozen_string_literal: true

module DocTemplate
  class XpathFunctions
    def case_insensitive_equals(node_set, str_to_match)
      node_set.find_all { |node| node.to_s.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

3 entries across 3 versions & 1 rubygems

Version Path
lcms-engine-0.2.0 lib/doc_template/xpath_functions.rb
lcms-engine-0.1.2 lib/doc_template/xpath_functions.rb
lcms-engine-0.1.0 lib/doc_template/xpath_functions.rb