Class: Chartnado::Evaluator::OperatorEvaluator

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Series
Defined in:
lib/chartnado/evaluator.rb

Instance Method Summary collapse

Methods included from Series

#median, #series_product, #series_ratio, #series_sum

Constructor Details

#initialize(object) ⇒ OperatorEvaluator

Returns a new instance of OperatorEvaluator.



32
33
34
# File 'lib/chartnado/evaluator.rb', line 32

def initialize(object)
  @object = object
end

Instance Method Details

#*(value) ⇒ Object



36
37
38
39
40
# File 'lib/chartnado/evaluator.rb', line 36

def *(value)
  without_operators do
    series_product(@object, value)
  end
end

#+(value) ⇒ Object



42
43
44
45
46
# File 'lib/chartnado/evaluator.rb', line 42

def +(value)
  without_operators do
    series_sum(value, @object)
  end
end

#-(value) ⇒ Object



48
49
50
# File 'lib/chartnado/evaluator.rb', line 48

def -(value)
  self + -1.0 * value
end

#/(value) ⇒ Object



52
53
54
55
56
# File 'lib/chartnado/evaluator.rb', line 52

def /(value)
  without_operators do
    series_ratio(@object, value)
  end
end