Skip to content

Commit

Permalink
Simplify Range#each for String elements
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Feb 11, 2013
1 parent a84d8f3 commit c8ff864
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions kernel/common/range.rb
Expand Up @@ -70,9 +70,7 @@ def each(&block)
end

when String
first.upto(last) do |s|
yield s unless @excl && s == last
end
first.upto(last, @excl, &block)
when Symbol
first.to_s.upto(last.to_s, @excl) do |str|
yield str.to_sym
Expand Down

0 comments on commit c8ff864

Please sign in to comment.