Class: Influx::Flux::MovingAverage

Inherits:
Object
  • Object
show all
Defined in:
lib/influx/flux/moving_average.rb

Instance Method Summary collapse

Constructor Details

#initialize(n:) ⇒ MovingAverage

Returns a new instance of MovingAverage.

Raises:



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_fluxObject



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