make properly commutative

master
muflax 2012-04-30 01:02:48 +02:00
parent 7dd27d60e7
commit 91589afb3f
2 changed files with 8 additions and 2 deletions

View File

@ -37,7 +37,13 @@ class Range
end
def coerce(other)
return self, other
if other.is_a? Range
return other, self
elsif other.is_a? Numeric
return (other..other), self
else
super
end
end
def pair_or_num operator, other

View File

@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "range_math"
s.version = "0.4.0"
s.version = "0.5.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["muflax"]