Class: Splunk::Stanza

Inherits:
Entity show all
Defined in:
lib/splunk-sdk-ruby/entity/stanza.rb

Overview

A class representing a stanza in a configuration file.

Stanza differs from Entity only in providing a length method to count the number of keys in it.

Instance Attribute Summary

Attributes inherited from ReadOnlyEntity

#name, #namespace, #resource, #service

Instance Method Summary collapse

Methods inherited from Entity

#[]=, #delete, #disable, #enable, #update

Methods inherited from ReadOnlyEntity

#[], #fetch, #initialize, #links, #read, #readmeta, #refresh

Constructor Details

This class inherits a constructor from Splunk::ReadOnlyEntity

Instance Method Details

#lengthObject

Returns the number of elements in the stanza.

The actual Atom feed returned will have extra fields giving metadata about the stanza, which will not be counted.

Returns: a nonnegative integer.



39
40
41
42
43
# File 'lib/splunk-sdk-ruby/entity/stanza.rb', line 39

def length()
  @state["content"].
      reject() { |k| k.start_with?("eai") || k == "disabled" }.
      length()
end