Class: CacheTree::Manager
- Inherits:
-
Object
- Object
- CacheTree::Manager
- Includes:
- Singleton
- Defined in:
- lib/cache_tree.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
Returns the value of attribute configuration.
Instance Method Summary collapse
-
#initialize ⇒ Manager
constructor
A new instance of Manager.
- #use(node, report, &block) ⇒ Object
Constructor Details
#initialize ⇒ Manager
Returns a new instance of Manager.
23 24 25 26 |
# File 'lib/cache_tree.rb', line 23 def initialize @current_link = nil @configuration = { :perform_caching => true } end |
Instance Attribute Details
#configuration ⇒ Object
Returns the value of attribute configuration.
21 22 23 |
# File 'lib/cache_tree.rb', line 21 def configuration @configuration end |
Instance Method Details
#use(node, report, &block) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/cache_tree.rb', line 28 def use(node, report, &block) return yield unless @configuration[:perform_caching] @node = node @node.map(:up) { |parent| parent.load! } return read if exists? report.call save(yield) end |