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.



23
24
25
26
# File 'lib/cache_tree.rb', line 23

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

Instance Attribute Details

#configurationObject

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