Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions spec/std/file_spec.cr
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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