Class: Wherever

Inherits:
Object
  • Object
show all
Includes:
Accessors, Adder, Getter, Lookup, Mark, Recalculate
Defined in:
lib/wherever/wherever.rb,
lib/wherever/wherever/mark.rb,
lib/wherever/wherever/adder.rb,
lib/wherever/wherever/getter.rb,
lib/wherever/wherever/lookup.rb,
lib/wherever/wherever/accessors.rb,
lib/wherever/wherever/recalculate.rb

Defined Under Namespace

Modules: Accessors, Adder, Getter, Lookup, Mark, Recalculate

Constant Summary collapse

LogMethods =
[:add, :get, :get_key_store, :mark]

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Mark

#mark

Methods included from Recalculate

#recalculate, #recalculate_identifier, #recalculate_with_key, #sum_group_for

Methods included from Lookup

#create_lookup

Methods included from Getter

#get

Methods included from Adder

#add

Methods included from Accessors

#get_key_store

Constructor Details

#initialize(options = {}, &grouping) ⇒ Wherever

Returns a new instance of Wherever.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/wherever/wherever.rb', line 16

def initialize(options={}, &grouping)
  @config = Configure.new(options)
  @marker = options[:marker] || 'current'
  if block_given?
    @grouping = grouping
  else
    @grouping = lambda do |values, data, record, keys|
      data.keys.each do  |key|
        values[key] += data[key]
      end
    end
  end
  @summing = {}
  if options['method_logging']
    MethodLogging.add(self.class)
  end
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



12
13
14
# File 'lib/wherever/wherever.rb', line 12

def config
  @config
end

#markerObject (readonly)

Returns the value of attribute marker.



12
13
14
# File 'lib/wherever/wherever.rb', line 12

def marker
  @marker
end

Instance Method Details

#add_grouping(&grouping) ⇒ Object



34
35
36
# File 'lib/wherever/wherever.rb', line 34

def add_grouping(&grouping)
  @grouping = grouping
end

#add_summing(key, options) ⇒ Object



38
39
40
# File 'lib/wherever/wherever.rb', line 38

def add_summing(key, options)
  @summing[key] = options
end