class Octodown::Support::Services::Riposter
Public Class Methods
call(file, &listener_callback)
click to toggle source
# File lib/octodown/support/services/riposter.rb, line 7 def self.call(file, &listener_callback) require 'listen' path = File.dirname(File.expand_path(file.path)) escaped_path = Regexp.escape(file.path) regex = Regexp.new("^#{escaped_path}$") @listener ||= Listen.to(path, only: regex) do |modified, added, _rm| listener_callback.call if modified.any? || added.any? end @listener.start end