module RailsWatcher

Constants

VERSION

Public Class Methods

configuration() { |configuration| ... } click to toggle source
# File lib/rails_watcher/configuration.rb, line 30
def self.configuration
  @@configuration ||= RailsWatcher::Configuration.new
  if block_given?
    yield @@configuration
  else
    @@configuration
  end
end
guess_const_name(file_path) click to toggle source
# File lib/rails_watcher/patches.rb, line 74
def self.guess_const_name file_path
  @@load_paths ||=  (
                      Rails.application.config.autoload_paths +
                      Rails.application.config.eager_load_paths
                    ).map do |autoload_path|
                      pn = Pathname.new autoload_path
                      pn.relative_path_from(Rails.root).to_s + "/"
                    end.to_set

  @@load_paths.reduce(file_path) do |truncated_file_path, load_path|
    truncated_file_path
      .sub(/^#{load_path}/, "")
      .sub(/^concerns/, "")
      .sub(/\.rb$/, "")
  end.camelize
end
my_watch_begins() click to toggle source
# File lib/rails_watcher.rb, line 13
def self.my_watch_begins
  Kernel.singleton_class.prepend Patches::KernelLoad
end