Class: DocTemplate::XpathFunctions

Inherits:
Object
  • Object
show all
Defined in:
lib/doc_template/xpath_functions.rb

Instance Method Summary collapse

Instance Method Details

#case_insensitive_contains(node_set, str_to_match) ⇒ Object



9
10
11
# File 'lib/doc_template/xpath_functions.rb', line 9

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) ⇒ Object



5
6
7
# File 'lib/doc_template/xpath_functions.rb', line 5

def case_insensitive_equals(node_set, str_to_match)
  node_set.find_all { |node| node.to_s.casecmp(str_to_match).zero? }
end

#case_regular(node_set, re_to_match) ⇒ Object



13
14
15
# File 'lib/doc_template/xpath_functions.rb', line 13

def case_regular(node_set, re_to_match)
  node_set.to_s.match?(Regexp.new(re_to_match, true)) ? node_set : []
end