-
-
Save bil-bas/278b563aa473c5c26994 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# "Shift" the first line off of the file | |
class File | |
def self.shift(file) | |
File.open(file) do |input| | |
first_line = input.gets | |
File.open(file, 'w') do |output| | |
input.each_line {|line| output.puts line } | |
end | |
first_line | |
end | |
end | |
end | |
puts File.shift("shift_file.txt") | |
puts | |
puts File.read("shift_file.txt") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment