Skip to content

Commit

Permalink
Remove File.each_line method that returns an iterator (#6301)
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite authored and Serdar Dogruyol committed Jul 3, 2018
1 parent 48530e5 commit fafdd63
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 27 deletions.
22 changes: 0 additions & 22 deletions spec/std/file_spec.cr
Expand Up @@ -82,28 +82,6 @@ describe "File" do
idx.should eq(20)
end

it "reads lines from file with each as iterator" do
idx = 0
File.each_line(datapath("test_file.txt")).each do |line|
if idx == 0
line.should eq("Hello World")
end
idx += 1
end
idx.should eq(20)
end

it "reads lines from file with each as iterator, chomp = false" do
idx = 0
File.each_line(datapath("test_file.txt"), chomp: false).each do |line|
if idx == 0
line.should eq("Hello World\n")
end
idx += 1
end
idx.should eq(20)
end

describe "empty?" do
it "gives true when file is empty" do
File.empty?(datapath("blank_test_file.txt")).should be_true
Expand Down
5 changes: 0 additions & 5 deletions src/file.cr
Expand Up @@ -656,11 +656,6 @@ class File < IO::FileDescriptor
end
end

# Returns an `Iterator` for each line in *filename*.
def self.each_line(filename, encoding = nil, invalid = nil, chomp = true)
open(filename, "r", encoding: encoding, invalid: invalid).each_line(chomp: chomp)
end

# Returns all lines in *filename* as an array of strings.
#
# ```
Expand Down

0 comments on commit fafdd63

Please sign in to comment.