class DocTemplate::XpathFunctions
Public Instance Methods
case_insensitive_contains(node_set, str_to_match)
click to toggle source
# File lib/doc_template/xpath_functions.rb, line 11 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
case_insensitive_equals(node_set, str_to_match)
click to toggle source
# File lib/doc_template/xpath_functions.rb, line 5 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
case_regular(node_set, re_to_match)
click to toggle source
# File lib/doc_template/xpath_functions.rb, line 15 def case_regular(node_set, re_to_match) node_set.to_s.match?(Regexp.new(re_to_match, true)) ? node_set : [] end