Class: Quby::RangeCategories
- Inherits:
-
Object
- Object
- Quby::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.
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_hash ⇒ Object
14 15 16 |
# File 'lib/quby/range_categories.rb', line 14 def as_range_hash @range_hash.freeze end |