Sha256: 35ce00b303d3814e48682216595a75c82bfdbfec2ea0a7ddd5d529aa79ff3bec
Contents?: true
Size: 656 Bytes
Versions: 6
Compression:
Stored size: 656 Bytes
Contents
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2023, by Samuel Williams. module Async module WebDriver # Helpers for working with XPath. module XPath # Escape a value for use in XPath. # # XPath 1.0 does not provide any standard mechanism for escaping quotes, so we have to do it ourselves using `concat`. # # @parameter value [String | Numeric] The value to escape. def self.escape(value) case value when String if value.include?("'") "concat('#{value.split("'").join("', \"'\", '")}')" else "'#{value}'" end else value.to_s end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems