Class: Splunk::CaseInsensitiveCollection

Inherits:
Collection show all
Defined in:
lib/splunk-sdk-ruby/collection/case_insensitive_collection.rb

Instance Attribute Summary

Attributes inherited from ReadOnlyCollection

#entity_class, #resource, #service

Instance Method Summary collapse

Methods inherited from Collection

#delete_if

Methods inherited from ReadOnlyCollection

#assoc, #atom_entry_to_entity, #each, #each_key, #each_pair, #each_value, #empty?, #keys, #length, #values

Constructor Details

#initialize(service, resource, entity_class = Entity) ⇒ CaseInsensitiveCollection

Returns a new instance of CaseInsensitiveCollection.



30
31
32
33
34
35
36
37
38
# File 'lib/splunk-sdk-ruby/collection/case_insensitive_collection.rb', line 30

def initialize(service, resource, entity_class=Entity)
  super(service, resource, entity_class)

  # +CaseInsensitiveCollection+ is only currently used for users and roles,
  # both of which require @+always_fetch=true+. This property is not inherent
  # to +CaseInsensitiveCollection+ in any particular way. It was just a
  # convenient place to put it.
  @always_fetch = true
end

Instance Method Details

#create(name, args = {}) ⇒ Object

The following methods only downcase the name they are passed, and should be invisible to the user.



42
43
44
# File 'lib/splunk-sdk-ruby/collection/case_insensitive_collection.rb', line 42

def create(name, args={}) # :nodoc:
  super(name.downcase(), args)
end

#delete(name, namespace = nil) ⇒ Object

:nodoc:



46
47
48
# File 'lib/splunk-sdk-ruby/collection/case_insensitive_collection.rb', line 46

def delete(name, namespace=nil) # :nodoc:
  super(name.downcase(), namespace)
end

#fetch(name, namespace = nil) ⇒ Object

:nodoc:



50
51
52
# File 'lib/splunk-sdk-ruby/collection/case_insensitive_collection.rb', line 50

def fetch(name, namespace=nil) # :nodoc:
  super(name.downcase(), namespace)
end

#has_key?(name) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)


54
55
56
# File 'lib/splunk-sdk-ruby/collection/case_insensitive_collection.rb', line 54

def has_key?(name) # :nodoc:
  super(name.downcase())
end