Sha256: 7254bef53e5ee2b3072fe920b1891e2d62573a83d146cf7f7f1e1b3f2e581d71

Contents?: true

Size: 828 Bytes

Versions: 1

Compression:

Stored size: 828 Bytes

Contents

# Author::        Christopher Brito (cbrito@gmail.com)
# Original Repo:: https://github.com/cbrito/splunk-client

require 'rubygems'
require 'nokogiri'
require File.expand_path File.join(File.dirname(__FILE__), 'splunk_result')

# Simplify the calling of single result data from xpaths into an objects
class SplunkResults
  attr_reader :results

  def initialize(rawResults)
    nokoResults = Nokogiri::Slop(rawResults)
    @results = Array.new
    
    if nokoResults.results.result.respond_to?("length")
      # Multiple Results, build array
      nokoResults.results.result.each do |resultObj|
        @results.push SplunkResult.new(resultObj)
      end
    else
      # Single results object
      @results.push SplunkResult.new(nokoResults.results.result)
    end
    
    return @results
  end
  
end #class SplunkResults

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
splunk-client-0.6.1 lib/splunk_client/splunk_results.rb