Class: Prickle::Capybara::XPath::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/prickle/capybara/xpath.rb

Instance Method Summary collapse

Constructor Details

#initialize(type, identifier) ⇒ Element

Returns a new instance of Element.



14
15
16
17
# File 'lib/prickle/capybara/xpath.rb', line 14

def initialize type, identifier
  @type = type
  @identifier = identifier
end

Instance Method Details

#identifierObject



23
24
25
26
27
# File 'lib/prickle/capybara/xpath.rb', line 23

def identifier
  return @identifier.each_pair.inject([]) do | xpath, (identifier, value) |
    xpath << XPath::Expression.new(identifier, value).to_s
  end.join Expression::SEPARATOR
end

#to_sObject



19
20
21
# File 'lib/prickle/capybara/xpath.rb', line 19

def to_s
  "//#{@type}[#{identifier}]"
end