Class: Splunk::PuppetResultsReader

Inherits:
ResultsReader show all
Defined in:
lib/splunk-sdk-ruby/resultsreader.rb

Overview

Version of ResultsReader that accepts an external parsing state.

ResultsReader sets up its own Fiber for doing SAX parsing of the XML, but for the MultiResultsReader, we want to share a single fiber among all the results readers that we create. PuppetResultsReader takes the fiber, is_preview, and fields information from its constructor and then exposes the same methods as ResultsReader.

You should never create an instance of PuppetResultsReader by hand. It will be passed back from iterating over a MultiResultsReader.

Instance Attribute Summary

Attributes inherited from ResultsReader

#fields

Instance Method Summary collapse

Methods inherited from ResultsReader

#is_preview?, #skip_remaining_results

Constructor Details

#initialize(fiber, is_preview, fields) ⇒ PuppetResultsReader

Returns a new instance of PuppetResultsReader.



531
532
533
534
535
536
# File 'lib/splunk-sdk-ruby/resultsreader.rb', line 531

def initialize(fiber, is_preview, fields)
  @valid = true
  @iteration_fiber = fiber
  @is_preview = is_preview
  @fields = fields
end

Instance Method Details

#eachObject



538
539
540
541
542
543
544
# File 'lib/splunk-sdk-ruby/resultsreader.rb', line 538

def each()
  if !@valid
    raise StandardError.new("Cannot iterate on ResultsReaders out of order.")
  else
    super()
  end
end

#invalidateObject



546
547
548
# File 'lib/splunk-sdk-ruby/resultsreader.rb', line 546

def invalidate()
  @valid = false
end