make properly commutative
parent
7dd27d60e7
commit
91589afb3f
|
@ -37,7 +37,13 @@ class Range
|
||||||
end
|
end
|
||||||
|
|
||||||
def coerce(other)
|
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
|
end
|
||||||
|
|
||||||
def pair_or_num operator, other
|
def pair_or_num operator, other
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = "range_math"
|
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.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||||
s.authors = ["muflax"]
|
s.authors = ["muflax"]
|
||||||
|
|
Loading…
Reference in New Issue