Class: Influx::Flux::Range

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(start: nil, stop: nil) ⇒ Range

Returns a new instance of Range.



10
11
12
13
# File 'lib/influx/flux/range.rb', line 10

def initialize(start: nil, stop: nil)
  @start = cast_value(start)
  @stop = cast_value(stop)
end

Instance Attribute Details

#startObject

Returns the value of attribute start.



8
9
10
# File 'lib/influx/flux/range.rb', line 8

def start
  @start
end

#stopObject

Returns the value of attribute stop.



8
9
10
# File 'lib/influx/flux/range.rb', line 8

def stop
  @stop
end

Instance Method Details

#to_fluxObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/influx/flux/range.rb', line 15

def to_flux
  params = []

  params << "start: #{@start}" if @start
  params << "stop: #{@stop}" if @stop

  <<~FLUX.chomp
    |> range(#{params.join(', ')})
  FLUX
end