Skip to content

Instantly share code, notes, and snippets.

@flori
Created January 2, 2015 09:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flori/05343376feaf194764f7 to your computer and use it in GitHub Desktop.
Save flori/05343376feaf194764f7 to your computer and use it in GitHub Desktop.
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