Class: YTools::Path::DescendantSelector

Inherits:
Selector
  • Object
show all
Defined in:
lib/ytools/path/selectors.rb

Instance Attribute Summary collapse

Attributes inherited from Selector

#subselector

Instance Method Summary collapse

Methods inherited from Selector

#chain, #chained?

Constructor Details

#initialize(match) ⇒ DescendantSelector

Returns a new instance of DescendantSelector.



84
85
86
# File 'lib/ytools/path/selectors.rb', line 84

def initialize(match)
  @match = match
end

Instance Attribute Details

#matchObject (readonly)

Returns the value of attribute match.



82
83
84
# File 'lib/ytools/path/selectors.rb', line 82

def match
  @match
end

Instance Method Details

#select(element) ⇒ Object



88
89
90
91
92
93
94
95
96
# File 'lib/ytools/path/selectors.rb', line 88

def select(element)
  results = []
  element_select(element, results)
  if results.length == 1
    results[0]
  else
    results
  end
end