class Spout::Models::Bucket

Defines a continuous or discrete bucket for tables and graphs

Attributes

start[RW]
stop[RW]

Public Class Methods

new(start, stop, discrete: false) click to toggle source
# File lib/spout/models/bucket.rb, line 9
def initialize(start, stop, discrete: false)
  @start = start
  @stop = stop
  @discrete = discrete
end

Public Instance Methods

display_name() click to toggle source
# File lib/spout/models/bucket.rb, line 19
def display_name
  return "#{@start}" if @discrete
  "#{@start} to #{@stop}"
end
in_bucket?(value) click to toggle source
# File lib/spout/models/bucket.rb, line 15
def in_bucket?(value)
  value >= @start && value <= @stop
end