lib/range_math.rb in range_math-0.5.0 vs lib/range_math.rb in range_math-0.6.0
- old
+ new
@@ -30,10 +30,14 @@
def to_f
(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
def coerce(other)
@@ -44,9 +48,11 @@
else
super
end
end
+ private
+
def pair_or_num operator, other
if other.is_a? Range
calc_pairs operator, other
elsif other.is_a? Numeric
calc_pairs operator, (other..other)