Class: Habaki::Selectors
- Defined in:
- lib/habaki/selectors.rb
Overview
Array of Selectors
Class Method Summary collapse
-
.parse(data) ⇒ Selectors
parse selectors from string.
Instance Method Summary collapse
-
#element_match?(element) ⇒ Boolean
does one of theses selectors match Visitor::Element ?.
-
#parse!(data) ⇒ void
parse selectors from string and append to current selectors.
- #read_from_katana(sels) ⇒ Object private
- #string(format = Formatter::Base.new) ⇒ String
Methods inherited from NodeArray
Class Method Details
.parse(data) ⇒ Selectors
parse selectors from string
7 8 9 10 11 |
# File 'lib/habaki/selectors.rb', line 7 def self.parse(data) sels = self.new sels.parse!(data) sels end |
Instance Method Details
#element_match?(element) ⇒ Boolean
does one of theses selectors match Visitor::Element ?
28 29 30 31 32 33 |
# File 'lib/habaki/selectors.rb', line 28 def element_match?(element) each do |selector| return true if selector.element_match?(element) end false end |
#parse!(data) ⇒ void
This method returns an undefined value.
parse selectors from string and append to current selectors
16 17 18 19 20 21 22 23 |
# File 'lib/habaki/selectors.rb', line 16 def parse!(data) return unless data out = Katana.parse_selectors(data) if out.selectors read_from_katana(out.selectors) end end |
#read_from_katana(sels) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
43 44 45 46 47 |
# File 'lib/habaki/selectors.rb', line 43 def read_from_katana(sels) sels.each do |sel| push Selector.read_from_katana(sel) end end |