Class: RexleCSS
- Inherits:
-
Object
- Object
- RexleCSS
- Defined in:
- lib/rexle-css.rb
Overview
file: rexle-css.rb
Instance Attribute Summary collapse
-
#to_xpath ⇒ Object
readonly
Returns the value of attribute to_xpath.
Instance Method Summary collapse
-
#initialize(raw_selector) ⇒ RexleCSS
constructor
A new instance of RexleCSS.
Constructor Details
#initialize(raw_selector) ⇒ RexleCSS
Returns a new instance of RexleCSS.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rexle-css.rb', line 9 def initialize(raw_selector) selector = raw_selector\ .gsub(/(\w+)#(\w+)/,'\1[@id="\2"]')\ .gsub(/#(\w+)/,'.[@id="\1"]')\ .gsub(/\.(\w+)/,'[@class="\1"]')\ .gsub(/ /,'//').gsub(/>/,'/')\ .gsub(/^\*$/,'.') @to_xpath = '//' + selector end |
Instance Attribute Details
#to_xpath ⇒ Object (readonly)
Returns the value of attribute to_xpath.
7 8 9 |
# File 'lib/rexle-css.rb', line 7 def to_xpath @to_xpath end |