Created
June 30, 2020 23:53
-
-
Save havenwood/e77057fbd0cfeab2e0677d2b5cae2fee to your computer and use it in GitHub Desktop.
Tracking some packages
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
# frozen_string_literal: true | |
module Tracker | |
FILENAME = 'tracking.txt' | |
SEPARATOR = ': ' | |
OPEN_SESAME = 'open' | |
OPENING = "Opening %<item>s ...\n" | |
module_function | |
def track | |
File.foreach(FILENAME) do |line| | |
line.partition(SEPARATOR).then do |item, _separator, url| | |
printf OPENING, item: item | |
system OPEN_SESAME, url | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment