Class: CacheTree::Manager

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/cache_tree.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeManager

Returns a new instance of Manager.



28
29
30
31
# File 'lib/cache_tree.rb', line 28

def initialize
  @current_link   = nil
  @configuration  = { :perform_caching => true }
end

Instance Attribute Details

#configurationObject

Returns the value of attribute configuration.



26
27
28
# File 'lib/cache_tree.rb', line 26

def configuration
  @configuration
end

Instance Method Details

#use(node, report, &block) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/cache_tree.rb', line 33

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