Class: Array

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

Instance Method Summary collapse

Instance Method Details

#prettyObject



60
61
62
# File 'lib/enumerable_weighted_sample.rb', line 60

def pretty
  map(&:inspect).join(", ")
end

#summarizeObject



57
58
59
# File 'lib/enumerable_weighted_sample.rb', line 57

def summarize
  each_with_object(Hash.new(0)){|foo,h| h[foo] += 1 }.pretty
end