Class: ToBarGraph::Bucketizer
- Inherits:
-
Object
- Object
- ToBarGraph::Bucketizer
- Defined in:
- lib/bucketizer.rb
Instance Method Summary collapse
- #create_buckets ⇒ Object
-
#initialize(data) ⇒ Bucketizer
constructor
A new instance of Bucketizer.
Constructor Details
#initialize(data) ⇒ Bucketizer
Returns a new instance of Bucketizer.
5 6 7 |
# File 'lib/bucketizer.rb', line 5 def initialize(data) @data = data end |
Instance Method Details
#create_buckets ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/bucketizer.rb', line 9 def create_buckets return create_buckets_from_hash if(@data.is_a?(Hash)) return create_buckets_from_array if(@data.is_a?(Array)) raise ArgumentError, "You need to provide either an Array or a Hash" end |