Created
January 2, 2015 09:25
-
-
Save flori/05343376feaf194764f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module FloatRange | |
def each | |
if Float === self.begin | |
current = self.begin | |
if exclude_end? | |
while current < self.end | |
yield current | |
current = current.next_float | |
end | |
else | |
while current <= self.end | |
yield current | |
current = current.next_float | |
end | |
end | |
else | |
super | |
end | |
end | |
end | |
class Range | |
prepend FloatRange | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment