Module: Shotgun

Defined in:
lib/shotgun.rb,
lib/shotgun/static.rb,
lib/shotgun/loader.rb,
lib/shotgun/favicon.rb

Defined Under Namespace

Classes: Loader, SkipFavicon, Static

Class Method Summary collapse

Class Method Details

.after_fork(&block) ⇒ Object



31
32
33
34
35
# File 'lib/shotgun.rb', line 31

def self.after_fork(&block)
  @after_fork ||= []
  @after_fork << block if block
  @after_fork
end

.after_fork!Object



41
42
43
# File 'lib/shotgun.rb', line 41

def self.after_fork!
  after_fork.each { |block| block.call }
end

.before_fork(&block) ⇒ Object



25
26
27
28
29
# File 'lib/shotgun.rb', line 25

def self.before_fork(&block)
  @before_fork ||= []
  @before_fork << block if block
  @before_fork
end

.before_fork!Object



37
38
39
# File 'lib/shotgun.rb', line 37

def self.before_fork!
  before_fork.each { |block| block.call }
end

.enable_copy_on_writeObject



12
13
14
# File 'lib/shotgun.rb', line 12

def self.enable_copy_on_write
  GC.copy_on_write_friendly = true if GC.respond_to?(:copy_on_write_friendly=)
end

.new(rackup_file, &block) ⇒ Object



8
9
10
# File 'lib/shotgun.rb', line 8

def self.new(rackup_file, &block)
  Loader.new(rackup_file, &block)
end

.preload(files = %w[./config/shotgun.rb ./shotgun.rb])) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/shotgun.rb', line 16

def self.preload(files=%w[./config/shotgun.rb ./shotgun.rb])
  files.each do |preload_file|
    if File.exist?(preload_file)
      module_eval File.read(preload_file), preload_file
      return preload_file
    end
  end
end