Class: CTioga2::Graphics::Styles::StyleSheet::XPath
- Inherits:
-
Object
- Object
- CTioga2::Graphics::Styles::StyleSheet::XPath
- Defined in:
- lib/ctioga2/graphics/styles/stylesheet.rb
Overview
An XPath, ie a series of XPathElement from outermost to innermost.
Instance Attribute Summary collapse
-
#elements ⇒ Object
From the innermost to outermost.
Class Method Summary collapse
Instance Method Summary collapse
- #matches?(obj) ⇒ Boolean
- #parse_string(txt) ⇒ Object
-
#to_s ⇒ Object
Returns a normalized version of the XPATH, that can be used as a hash key.
-
#typed? ⇒ Boolean
Returns true if the innermost element has a type.
Instance Attribute Details
#elements ⇒ Object
From the innermost to outermost
128 129 130 |
# File 'lib/ctioga2/graphics/styles/stylesheet.rb', line 128 def elements @elements end |
Class Method Details
Instance Method Details
#matches?(obj) ⇒ Boolean
151 152 153 |
# File 'lib/ctioga2/graphics/styles/stylesheet.rb', line 151 def matches?(obj) return match_chain(obj, @elements) end |
#parse_string(txt) ⇒ Object
130 131 132 133 134 |
# File 'lib/ctioga2/graphics/styles/stylesheet.rb', line 130 def parse_string(txt) @elements = txt.gsub(/\s*>/, '>').split(/\s+/).reverse.map do |x| XPathElement.from_text(x) end end |
#to_s ⇒ Object
Returns a normalized version of the XPATH, that can be used as a hash key.
157 158 159 |
# File 'lib/ctioga2/graphics/styles/stylesheet.rb', line 157 def to_s return @elements.reverse.map { |x| x.to_s }.join(" ") end |
#typed? ⇒ Boolean
Returns true if the innermost element has a type
143 144 145 146 147 148 149 |
# File 'lib/ctioga2/graphics/styles/stylesheet.rb', line 143 def typed? if @elements.first.obj_type return true else return false end end |