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

+ (Object) after_fork(&block)



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

+ (Object) after_fork!



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

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

+ (Object) before_fork(&block)



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

+ (Object) before_fork!



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

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

+ (Object) enable_copy_on_write



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

+ (Object) new(rackup_file, &block)



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

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

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



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