class Kameleon::DSL::Context::JoinInToOne

Public Instance Methods

selector() click to toggle source
# File lib/kameleon/dsl/context/scope.rb, line 99
def selector
  [:xpath, xpath_selector]
end

Private Instance Methods

cleanup(others) click to toggle source
# File lib/kameleon/dsl/context/scope.rb, line 109
def cleanup(others)
  others.collect { |xpath| xpath.gsub(/^\.+/, '').gsub(/^\/+/, '') }
end
normalized() click to toggle source

TODO detect_selector should be in module

# File lib/kameleon/dsl/context/scope.rb, line 118
def normalized
  params.map { |param| scope.send(:detect_selector, param) }
end
xpath_selector() click to toggle source
# File lib/kameleon/dsl/context/scope.rb, line 105
def xpath_selector
  ([xpaths.first] + cleanup(xpaths[1..-1])).join("//")
end
xpaths() click to toggle source
# File lib/kameleon/dsl/context/scope.rb, line 113
def xpaths
  @xpaths ||= normalized.map { |param| param.first == :css ? ::Nokogiri::CSS.xpath_for(param.last).first : param.last }
end