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
gem "rb-inotify" | |
require 'rb-inotify' | |
gem "listen" | |
require "listen" | |
# BEGIN MONKEY PATCH OF LISTEN GEM | |
Listen::Adapter::Linux::DEFAULTS.tap do |defaults| | |
# Add :modify to the inotify events monitored by the Linux adapter | |
new_defaults = defaults.merge(events: defaults[:events] + [:modify]) |
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
# A queue that you can pass to IO.select. | |
# | |
# NOT THREAD SAFE: Only one thread should write; only one thread should read. | |
# | |
# Purpose: | |
# Allow easy integration of data-producing threads into event loops. The | |
# queue will be readable from select's perspective as long as there are | |
# objects in the queue. | |
# | |
# Implementation: |