module RailsWatcher::Patches::KernelLoad
Public Instance Methods
load(filename, wrap=false)
click to toggle source
Calls superclass method
# File lib/rails_watcher/patches.rb, line 5 def load filename, wrap=false ret = super relative_path = begin pn = Pathname.new filename pn.relative_path_from(Rails.root).to_s end if !RailsWatcher.configuration.ignored_files.include?(relative_path) && !RailsWatcher.configuration.ignored_paths.any? { |ignored_path| relative_path.start_with?(ignored_path) } const_name = RailsWatcher.configuration.file_constant_mapping[relative_path] || RailsWatcher.guess_const_name(relative_path) return ret if RailsWatcher.configuration.ignored_constants.include? const_name if (Object.const_defined?(const_name) rescue return ret) ConstModifier.modify const_name, filename elsif Object.const_defined? const_name.upcase ConstModifier.modify const_name.upcase, filename else warn <<~WARNING ============== Rails Watcher Warning ============== Find constant failed: File path: "#{relative_path}" Guessed const name: "#{const_name}" ============== Rails Watcher Warning ============== WARNING end end ret end