Class: RangeCategories

Inherits:
Object
  • Object
show all
Defined in:
lib/quby/range_categories.rb

Instance Method Summary collapse

Constructor Details

#initialize(*range_categories) ⇒ RangeCategories

Returns a new instance of RangeCategories.



4
5
6
7
8
9
10
11
# File 'lib/quby/range_categories.rb', line 4

def initialize(*range_categories)
  if range_categories.length.even? || range_categories.length < 3
    fail "RangeCategories should be of the form (0, 'label 0-10', 10, 'label 10-20', 20)"
  end

  @range_hash = {}
  parse_ranges(range_categories)
end

Instance Method Details

#as_range_hashObject



13
14
15
# File 'lib/quby/range_categories.rb', line 13

def as_range_hash
  @range_hash.freeze
end