Class: Influx::Flux::MovingAverage
- Inherits:
-
Object
- Object
- Influx::Flux::MovingAverage
- Defined in:
- lib/influx/flux/moving_average.rb
Instance Method Summary collapse
-
#initialize(n:) ⇒ MovingAverage
constructor
A new instance of MovingAverage.
- #to_flux ⇒ Object
Constructor Details
#initialize(n:) ⇒ MovingAverage
Returns a new instance of MovingAverage.
8 9 10 11 12 |
# File 'lib/influx/flux/moving_average.rb', line 8 def initialize(n:) raise Influx::Error.new('N value has to be Integer!') unless n.is_a?(Integer) @n = n end |
Instance Method Details
#to_flux ⇒ Object
14 15 16 17 18 |
# File 'lib/influx/flux/moving_average.rb', line 14 def to_flux " |> movingAverage(n: \#{@n})\n FLUX\nend\n".chomp |