range_math 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/range_math.rb +7 -1
  2. data/range_math.gemspec +1 -1
  3. metadata +1 -1
data/lib/range_math.rb CHANGED
@@ -37,7 +37,13 @@ class Range
37
37
  end
38
38
 
39
39
  def coerce(other)
40
- return self, other
40
+ if other.is_a? Range
41
+ return other, self
42
+ elsif other.is_a? Numeric
43
+ return (other..other), self
44
+ else
45
+ super
46
+ end
41
47
  end
42
48
 
43
49
  def pair_or_num operator, other
data/range_math.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "range_math"
3
- s.version = "0.4.0"
3
+ s.version = "0.5.0"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["muflax"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: range_math
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: