Class: Quby::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.



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

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



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

def as_range_hash
  @range_hash.freeze
end