Sha256: 72fe830517d8ef1139f62c1ddbd90492f3f05d376b63efaafdbc980961a7d85a

Contents?: true

Size: 668 Bytes

Versions: 3

Compression:

Stored size: 668 Bytes

Contents

require_relative 'xpath/expression'
module Prickle
  module Capybara
    module XPath

      def self.for_element_with type, identifier
        XPath::Element.new(type,identifier).to_s
      end

      private

      class Element

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

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

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

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prickle-0.1.0 lib/prickle/capybara/xpath.rb
prickle-0.0.6 lib/prickle/capybara/xpath.rb
prickle-0.0.5 lib/prickle/capybara/xpath.rb