Last active
December 17, 2015 20:48
-
-
Save lguardiola/5670101 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
10.times do |i| | |
puts i | |
end | |
puts DATA.read | |
__END__ | |
This is | |
a data content! |
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
10.times do |i| | |
puts i | |
end | |
DATA.rewind | |
puts DATA.read | |
__END__ | |
This is | |
a data content! |
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
DATA.flock(File::LOCK_EX | File::LOCK_NB) or abort "Already running." | |
trap("INT", "EXIT") | |
puts "Running..." | |
loop do | |
sleep | |
end | |
__END__ | |
DO NOT DELETE: use for locking |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment