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! ⇒ void
This method returns an undefined value.
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! ⇒ Boolean
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 # Best-effort – if Rails isn't available yet we'll try again later return false end server_command = T.let(nil, T.untyped) # rubocop:disable Sorbet/ConstantsFromStrings begin server_command = ::Object.const_get("Rails::Command::ServerCommand") rescue NameError server_command = nil end # rubocop:enable Sorbet/ConstantsFromStrings return false unless server_command patch_server_command(server_command) true end |
.patch_server_command(server_command) ⇒ void
This method returns an undefined value.
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 |