Module: Simple::Httpd::Reloader

Included in:
BaseController
Defined in:
lib/simple/httpd/reloader.rb

Constant Summary collapse

H =
::Simple::Httpd::Helpers

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#reloading_pathsObject

Returns the value of attribute reloading_paths.



10
11
12
# File 'lib/simple/httpd/reloader.rb', line 10

def reloading_paths
  @reloading_paths
end

Class Method Details

.attach(target, paths:, reloading_instance: target) ⇒ Object



2
3
4
5
6
# File 'lib/simple/httpd/reloader.rb', line 2

def self.attach(target, paths:, reloading_instance: target)
  target.extend self
  target.load!(paths: paths, reloading_instance: reloading_instance)
  target
end

Instance Method Details

#load!(paths:, reloading_instance:) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/simple/httpd/reloader.rb', line 12

def load!(paths:, reloading_instance:)
  paths = Array(paths)
  paths = nil if paths.empty?

  @__reload_paths__ = paths
  @__reloading_instance__ = reloading_instance

  reload_all_changed_files
end

#reload!Object



22
23
24
25
26
27
28
29
30
# File 'lib/simple/httpd/reloader.rb', line 22

def reload!
  # if this is a class, and its superclass is also reloadable,
  # reload the superclass first.
  if respond_to?(:superclass) && superclass&.respond_to?(:reload!)
    superclass.reload!
  end

  reload_all_changed_files
end