Module: Jam::CSStoXPath
Constant Summary collapse
- RULES =
[]
Instance Method Summary collapse
Instance Method Details
#css_to_xpath(css) ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/jam/css_to_xpath.rb', line 117 def css_to_xpath(css) RULES.each do |f, t| case t when Proc css = css.gsub(f, &t) else css = css.gsub(f, t) end end return ".//" + css; end |
#rule(re_from, re_to = nil, &block) ⇒ Object
25 26 27 |
# File 'lib/jam/css_to_xpath.rb', line 25 def rule(re_from, re_to=nil, &block) RULES << [re_from, re_to || block] end |