Class: RangeCategories
- Inherits:
-
Object
- Object
- RangeCategories
- Defined in:
- lib/quby/range_categories.rb
Instance Method Summary collapse
- #as_range_hash ⇒ Object
-
#initialize(*range_categories) ⇒ RangeCategories
constructor
A new instance of RangeCategories.
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_hash ⇒ Object
13 14 15 |
# File 'lib/quby/range_categories.rb', line 13 def as_range_hash @range_hash.freeze end |