Class: Slate::Calculation::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/slate/calculation.rb

Direct Known Subclasses

Last, Mean

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(graph) ⇒ Base

Returns a new instance of Base.



20
21
22
# File 'lib/slate/calculation.rb', line 20

def initialize(graph)
  @graph = graph
end

Class Method Details

.description(description = nil) ⇒ Object



15
16
17
18
# File 'lib/slate/calculation.rb', line 15

def self.description(description=nil)
  return @description if description.nil?
  @description = description
end

.name(name = nil) ⇒ Object



10
11
12
13
# File 'lib/slate/calculation.rb', line 10

def self.name(name=nil)
  return @name if name.nil?
  @name = name
end

Instance Method Details

#resultObject



24
25
26
27
28
29
30
# File 'lib/slate/calculation.rb', line 24

def result
  targets.map do |target|
    name = target.first
    points = target.last
    target name, map(points)
  end
end