Module: LogStruct::RailsBootBannerSilencer
- Extended by:
- T::Sig
- Defined in:
- lib/log_struct/rails_boot_banner_silencer.rb
Defined Under Namespace
Modules: ServerCommandSilencer
Class Method Summary
collapse
Class Method Details
.install! ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/log_struct/rails_boot_banner_silencer.rb', line 13
def self.install!
return if @installed
@installed = true
return unless ARGV.include?("server")
patch!
end
|
.patch! ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/log_struct/rails_boot_banner_silencer.rb', line 22
def self.patch!
begin
require "rails/command"
require "rails/commands/server/server_command"
rescue LoadError
return false
end
server_command = T.let(nil, T.untyped)
begin
server_command = ::Object.const_get("Rails::Command::ServerCommand")
rescue NameError
server_command = nil
end
return false unless server_command
patch_server_command(server_command)
true
end
|
.patch_server_command(server_command) ⇒ Object
46
47
48
49
50
|
# File 'lib/log_struct/rails_boot_banner_silencer.rb', line 46
def self.patch_server_command(server_command)
return if server_command <= ServerCommandSilencer
server_command.prepend(ServerCommandSilencer)
end
|