Class: Goldmine::RollupCleanRoom

Inherits:
Object
  • Object
show all
Defined in:
lib/goldmine/rollup_clean_room.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, cache = {}) ⇒ RollupCleanRoom

Returns a new instance of RollupCleanRoom.



5
6
7
8
# File 'lib/goldmine/rollup_clean_room.rb', line 5

def initialize(name, cache={})
  @name = name
  @cache = cache
end

Instance Attribute Details

#cacheObject (readonly)

Returns the value of attribute cache.



3
4
5
# File 'lib/goldmine/rollup_clean_room.rb', line 3

def cache
  @cache
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/goldmine/rollup_clean_room.rb', line 3

def name
  @name
end

Instance Method Details

#eigenObject



10
11
12
13
14
# File 'lib/goldmine/rollup_clean_room.rb', line 10

def eigen
  class << self
    self
  end
end

#rollup(pivoted_list, &block) ⇒ Object



16
17
18
19
# File 'lib/goldmine/rollup_clean_room.rb', line 16

def rollup(pivoted_list, &block)
  eigen.instance_eval { define_method(:do_rollup, &block) }
  @cache[name] = do_rollup(pivoted_list)
end