Sha256: fbaf410cd465208bd80d114c03f81807a3a1a00710d6a852686f9506c287ee3b

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

module JmeterPerf
  class DSL
    # DSL method synonymous with the JMeter Element HTMLLinkParser
    # @see https://github.com/jlurena/jmeter_perf/wiki/1.-DSL-Documentation#htmllinkparser
    # @param [Hash] params Parameters for the HTMLLinkParser element (default: `{}`).
    # @yield block to attach to the HTMLLinkParser element
    # @return [JmeterPerf::HTMLLinkParser], a subclass of JmeterPerf::DSL that can be chained with other DSL methods.
    def html_link_parser(params = {}, &)
      node = JmeterPerf::HTMLLinkParser.new(params)
      attach_node(node, &)
    end
  end

  class HTMLLinkParser
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "HTMLLinkParser" : (params[:name] || "HTMLLinkParser")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <AnchorModifier guiclass="AnchorModifierGui" testclass="AnchorModifier" testname="#{testname}" enabled="true"/>
      EOS
      update params
      update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jmeter_perf-0.0.7 lib/jmeter_perf/dsl/html_link_parser.rb