lib/splunk_client/splunk_results.rb in splunk-client-0.6.1 vs lib/splunk_client/splunk_results.rb in splunk-client-0.7.0
- old
+ new
@@ -8,12 +8,15 @@
# 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
-
+
+ return @results if rawResults.strip.empty?
+
+ nokoResults = Nokogiri::Slop(rawResults)
+
if nokoResults.results.result.respond_to?("length")
# Multiple Results, build array
nokoResults.results.result.each do |resultObj|
@results.push SplunkResult.new(resultObj)
end