Skip to content

Commit 99811e9

Browse files
committed
[refactor] simplify and remove context! (there are nil checks)
1 parent 097ae9a commit 99811e9

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/main/ruby/jruby/rack.rb

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99

1010
module JRuby
1111
module Rack
12-
13-
def self.booter; @booter end # :nodoc TODO do we need to keep after boot! ?!
14-
1512
class << self
13+
# @private the (last) `JRuby::Rack::Booter` that performed `boot!` (used with tests)
14+
attr_reader :booter
1615

1716
# @return [String] the application (root) path.
1817
# @see JRuby::Rack::Booter#export_global_settings
@@ -44,24 +43,23 @@ def context; @context ||= $servlet_context end
4443

4544
# Sets the ("global") context for `JRuby::Rack`.
4645
def context=(context)
47-
@context = context; @@logger = nil # reset the logger
46+
@context = context
47+
@@logger = nil # reset the logger
4848
end
4949

5050
@@logger = nil
5151
# Returns a {Logger} instance that uses the {#context} as a logger.
52-
def logger; @@logger ||= Logger.new(context!) end
53-
# @private
52+
def logger; @@logger ||= Logger.new(context) end
53+
# @private only used with tests
5454
def logger=(logger); @@logger = logger end
5555

5656
private
5757

5858
# @deprecated Mostly for compatibility - not used anymore.
59-
def logdev; ServletLog.new(context!) end; alias servlet_log logdev
60-
61-
def context!; context || raise('no context available') end
59+
def logdev; ServletLog.new(context) end
60+
alias servlet_log logdev
6261

6362
end
64-
6563
end
6664
end
6765

0 commit comments

Comments
 (0)