Module: RailsDevelopmentBoost::DependenciesPatch::InstrumentationPatch

Defined in:
lib/rails_development_boost/dependencies_patch/instrumentation_patch.rb

Defined Under Namespace

Modules: Files, Instrumenter, LoadedFile

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.applied?Boolean

Returns:

  • (Boolean)


106
107
108
# File 'lib/rails_development_boost/dependencies_patch/instrumentation_patch.rb', line 106

def self.applied?
  ActiveSupport::Dependencies.singleton_class.include?(self)
end

.apply!Object



98
99
100
101
102
103
104
# File 'lib/rails_development_boost/dependencies_patch/instrumentation_patch.rb', line 98

def self.apply!
  unless applied?
    ActiveSupport::Dependencies.extend self
    RailsDevelopmentBoost::LoadedFile.send :include, LoadedFile
    RailsDevelopmentBoost::LoadedFile::Files.send :include, Files
  end
end

Instance Method Details

#boost_log(action, msg = nil) ⇒ Object



126
127
128
129
# File 'lib/rails_development_boost/dependencies_patch/instrumentation_patch.rb', line 126

def boost_log(action, msg = nil)
  action, msg = msg, action unless msg
  raw_boost_log("#{ "[#{action}] " if action}#{msg}")
end

#boost_log_nestedObject



136
137
138
139
140
141
# File 'lib/rails_development_boost/dependencies_patch/instrumentation_patch.rb', line 136

def boost_log_nested
  @removal_nesting = (@removal_nesting || 0) + 1
  yield
ensure
  @removal_nesting -= 1
end

#boost_log_schedule_const_removal(action, msg, const_name) ⇒ Object



131
132
133
134
# File 'lib/rails_development_boost/dependencies_patch/instrumentation_patch.rb', line 131

def boost_log_schedule_const_removal(action, msg, const_name)
  action = "#{action} | #{ActiveSupport::Dependencies.constants_to_remove.seen?(const_name) ? 'SKIP' : 'SCHEDULED'}"
  boost_log(action, msg)
end

#load_file_from_explicit_load(expanded_path) ⇒ Object



121
122
123
124
# File 'lib/rails_development_boost/dependencies_patch/instrumentation_patch.rb', line 121

def load_file_from_explicit_load(expanded_path)
  boost_log('EXPLICIT_LOAD_REQUEST', expanded_path)
  super
end

#load_file_without_constant_tracking(path, *args) ⇒ Object



110
111
112
113
114
# File 'lib/rails_development_boost/dependencies_patch/instrumentation_patch.rb', line 110

def load_file_without_constant_tracking(path, *args)
  other_args = ", #{args.map(&:inspect).join(', ')}" if args.any?
  boost_log('LOAD', "load_file(#{path.inspect}#{other_args})")
  super
end

#remove_constant_without_handling_of_connections(const_name) ⇒ Object



116
117
118
119
# File 'lib/rails_development_boost/dependencies_patch/instrumentation_patch.rb', line 116

def remove_constant_without_handling_of_connections(const_name)
  boost_log('REMOVE_CONST', const_name)
  super
end