Skip to content

Commit

Permalink
to_range producing range with 0 as begin value due to calling to_i on…
Browse files Browse the repository at this point in the history
… string starting with paren
  • Loading branch information
David North committed Feb 10, 2010
1 parent cfb4711 commit 3b2a996
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions volume_pricing_extension.rb
Expand Up @@ -69,10 +69,10 @@ def to_range
case self.count('.')
when 2
elements = self.split('..')
return Range.new(elements[0].to_i, elements[1].to_i)
return Range.new(elements[0].from(1).to_i, elements[1].to_i)
when 3
elements = self.split('...')
return Range.new(elements[0].to_i, elements[1].to_i-1)
return Range.new(elements[0].from(1).to_i, elements[1].to_i-1)
else
raise ArgumentError.new("Couldn't convert to Range: #{self}")
end
Expand Down

0 comments on commit 3b2a996

Please sign in to comment.