String#each_byte to use String#bytes; close #508

This commit is contained in:
Yukihiro Matsumoto
2012-11-01 06:13:02 +09:00
parent fe36bdb7f1
commit 57910ca535
+1 -1
View File
@@ -118,7 +118,7 @@ class String
##
# Call the given block for each byte of +self+.
def each_byte(&block)
bytes = self.unpack("C*")
bytes = self.bytes
pos = 0
while(pos < bytes.size)
block.call(bytes[pos])