From e6c7f81d9a45c6618422962966c20834158d583d Mon Sep 17 00:00:00 2001 From: muflax Date: Sun, 28 Jul 2013 17:16:04 +0200 Subject: [PATCH] support to_i --- lib/range_math.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/range_math.rb b/lib/range_math.rb index 9213a72..da68ff3 100644 --- a/lib/range_math.rb +++ b/lib/range_math.rb @@ -32,6 +32,10 @@ class Range (self.begin.to_f..self.end.to_f) end + def to_i + (self.begin.to_i..self.end.to_i) + end + def average (self.begin + self.end) / 2.0 end