Class: Redfish::PropertyCache

Inherits:
Object
  • Object
show all
Defined in:
lib/redfish/property_cache.rb

Instance Method Summary collapse

Constructor Details

#initialize(properties) ⇒ PropertyCache

Returns a new instance of PropertyCache.



4
5
6
# File 'lib/redfish/property_cache.rb', line 4

def initialize(properties)
  @properties = properties.dup
end

Instance Method Details

#[](key) ⇒ Object



17
18
19
# File 'lib/redfish/property_cache.rb', line 17

def [](key)
  raw_properties[key] || ''
end

#[]=(key, value) ⇒ Object



13
14
15
# File 'lib/redfish/property_cache.rb', line 13

def []=(key, value)
  raw_properties[key] = value
end

#any_property_start_with?(prefix) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
# File 'lib/redfish/property_cache.rb', line 8

def any_property_start_with?(prefix)
  regex = /^#{Regexp.escape(prefix)}/
  raw_properties.keys.any? { |k| k =~ regex }
end

#propertiesObject



21
22
23
# File 'lib/redfish/property_cache.rb', line 21

def properties
  raw_properties.dup
end