Module: NMax
- Defined in:
- lib/n_max.rb,
lib/n_max/version.rb
Constant Summary collapse
- VERSION =
"0.1.1"
Class Method Summary collapse
Class Method Details
.sanitize(number) ⇒ Object
14 15 16 |
# File 'lib/n_max.rb', line 14 def self.sanitize(number) number.sub(/\D/,'') end |
.show_n_max(lines, count) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/n_max.rb', line 4 def self.show_n_max(lines, count) count = 1 if count.to_i <= 0 list = [] lines.each do |number| list << sanitize(number).to_i list = list.sort!.last(count) if list.length > count end list end |