Using class knowledge (see ie rental code we wrote create simple class)
create a class MyRange
that has following methods:
range = MyRange.new(2,6)
range.min #=> 2
range.max #=> 6
range.to_a #=> [2,3,4,5,6]
As a first bonus allow special constructor:
range = MyRange.new(min: 2, max: 6)
This gist will help to understand it: https://gist.github.com/slawosz/8db7fc43e01b9d003564
As a second bonus explore method next:
1.next #=> 2
"A".next #=> "B"
Use this method to be able to create range from any object that supports method next
:
range = MyRange.new("A","B")