class Listen::Change
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/listen/change.rbs class Listen::Change def initialize: (Listen::Change::Config config, Listen::Record record) -> void end
TODO: rename to Snapshot
def initialize(config, record)
Experimental RBS support (using type sampling data from the type_fusion
project).
def initialize: (Listen::Change::Config config, Listen::Record record) -> void
This signature was generated using 1 sample from 1 application.
def initialize(config, record) @config = config @record = record end
def invalidate(type, rel_path, options)
rubocop:disable Metrics/CyclomaticComplexity
rubocop:disable Metrics/MethodLength
Invalidate some part of the snapshot/record (dir, file, subtree, etc.)
def invalidate(type, rel_path, options) watched_dir = Pathname.new(record.root) change = options[:change] cookie = options[:cookie] if !cookie && @config.silenced?(rel_path, type) Listen.logger.debug { "(silenced): #{rel_path.inspect}" } return end path = watched_dir + rel_path Listen.logger.debug do log_details = options[:silence] && 'recording' || change || 'unknown' "#{log_details}: #{type}:#{path} (#{options.inspect})" end if change options = cookie ? { cookie: cookie } : {} @config.queue(type, change, watched_dir, rel_path, options) elsif type == :dir # NOTE: POSSIBLE RECURSION # TODO: fix - use a queue instead Directory.scan(self, rel_path, options) elsif (change = File.change(record, rel_path)) && !options[:silence] @config.queue(:file, change, watched_dir, rel_path) end end