Class: CFA::AugeasKeysCache
- Inherits:
-
Object
- Object
- CFA::AugeasKeysCache
- Defined in:
- lib/cfa/augeas_parser/keys_cache.rb
Overview
A cache that holds all avaiable keys in an Augeas tree. It is used to prevent too many ‘aug.match` calls which are expensive.
Instance Method Summary collapse
-
#initialize(aug, prefix) ⇒ AugeasKeysCache
constructor
initialize cache from passed Augeas object.
-
#keys_for_prefix(prefix) ⇒ Object
List of keys available on given prefix.
Constructor Details
#initialize(aug, prefix) ⇒ AugeasKeysCache
initialize cache from passed Augeas object
8 9 10 |
# File 'lib/cfa/augeas_parser/keys_cache.rb', line 8 def initialize(aug, prefix) fill_cache(aug, prefix) end |
Instance Method Details
#keys_for_prefix(prefix) ⇒ Object
Returns list of keys available on given prefix.
13 14 15 |
# File 'lib/cfa/augeas_parser/keys_cache.rb', line 13 def keys_for_prefix(prefix) @cache[prefix] || [] end |