Displaying 1 result from an estimated 1 matches for "count_lines3".
Did you mean:
count_lines
2012 Sep 23
1
ruby koans don't understand the principle sandwhich code
...------------------------
def find_line2(file_name)
# Rewrite find_line using the file_sandwich library function.
end
def test_finding_lines2
assert_equal __, find_line2("example_file.txt")
end
# ------------------------------------------------------------------
def count_lines3(file_name)
open(file_name) do |file|
count = 0
while line = file.gets
count += 1
end
count
end
end
def test_open_handles_the_file_sandwich_when_given_a_block
assert_equal __, count_lines3("example_file.txt")
end
end
But I don''...