Class: Misc::Range

Inherits:
Object
  • Object
show all
Includes:
AttributesReader
Defined in:
lib/misc/range.rb

Overview

A bucket associated with a specific range

Instance Method Summary collapse

Methods included from AttributesReader

#attributes

Constructor Details

#initialize(from: nil, to: nil, key: '') ⇒ Range

Returns a new instance of Range.

Parameters:

  • from (String|Float) (defaults to: nil)
  • to (String|Float) (defaults to: nil)
  • key (String) (defaults to: '')


11
12
13
14
15
# File 'lib/misc/range.rb', line 11

def initialize(from: nil, to: nil, key: '')
  @from = from if from.present?
  @to = to if to.present?
  @key = key if key.present?
end

Instance Method Details

#settingsObject

return [Hash] serialized json query for object



18
19
20
21
22
23
24
# File 'lib/misc/range.rb', line 18

def settings
  settings = {}
  settings[:key] = @key if @key.present?
  settings[:from] = @from if @from.present?
  settings[:to] = @to if @to.present?
  settings
end