Skip to content

Commit

Permalink
Merge pull request #789 from kmuto/ruby19
Browse files Browse the repository at this point in the history
ruby 1.8 was not supported
  • Loading branch information
takahashim authored Jul 6, 2017
2 parents ba2777f + 48fb231 commit 1bc601f
Showing 1 changed file with 3 additions and 28 deletions.
31 changes: 3 additions & 28 deletions lib/review/extentions/string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,7 @@
Encoding.default_external = "UTF-8"
end

unless String.method_defined?(:lines)
# Ruby 1.8
class String
alias_method :lines, :to_a
end
end

if String.method_defined?(:bytesize)
# Ruby 1.9
class String
alias_method :charsize, :size
end
else
# Ruby 1.8
class String
alias_method :bytesize, :size

def charsize
split(//).size
end
end
end

unless String.method_defined?(:each)
# Ruby 1.9
class String
alias_method :each, :each_line
end
class String
alias_method :charsize, :size
alias_method :each, :each_line
end

0 comments on commit 1bc601f

Please sign in to comment.