Sha256: 1aba7588320337ad669f0ed08f2f728405fd376f09f5c272553522f353cad57e

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

module JmeterPerf
  class DSL
    def regular_expression_extractor(params = {}, &)
      node = JmeterPerf::RegularExpressionExtractor.new(params)
      attach_node(node, &)
    end
  end

  class RegularExpressionExtractor
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "RegularExpressionExtractor" : (params[:name] || "RegularExpressionExtractor")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="#{testname}" enabled="true">
          <stringProp name="RegexExtractor.useHeaders">false</stringProp>
          <stringProp name="RegexExtractor.refname"/>
          <stringProp name="RegexExtractor.regex"/>
          <stringProp name="RegexExtractor.template"/>
          <stringProp name="RegexExtractor.default"/>
          <stringProp name="RegexExtractor.match_number"/>
          <stringProp name="Sample.scope">all</stringProp>
          <boolProp name="RegexExtractor.default_empty_value"/>
        </RegexExtractor>
      EOS
      update params
      update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jmeter_perf-0.0.6 lib/jmeter_perf/dsl/regular_expression_extractor.rb
jmeter_perf-0.0.2 lib/jmeter_perf/dsl/regular_expression_extractor.rb