Sha256: bc6077bd79a76feeb012dd7522f4e8aa17c9498226f88bf080e9811c888238d9

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

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

  class SimpleConfigElement
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "SimpleConfigElement" : (params[:name] || "SimpleConfigElement")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <ConfigTestElement guiclass="SimpleConfigGui" testclass="ConfigTestElement" 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/simple_config_element.rb