Skip to content

Commit ff96766

Browse files
committed
Fix rubocop linter
Add pstore gem for Ruby 4.0 compatibility Add logger and ostruct gems for Ruby 4.0 compatibility
1 parent 2f5d245 commit ff96766

File tree

8 files changed

+15
-8
lines changed

8 files changed

+15
-8
lines changed

Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,9 @@ end
2727
if RUBY_VERSION >= '3.4'
2828
gem 'mutex_m' # TODO: remove this once as-notifications has such a dependency
2929
end
30+
31+
if RUBY_VERSION >= '4.0'
32+
gem 'pstore'
33+
gem 'logger'
34+
gem 'ostruct'
35+
end

examples/logging.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def handle_event(event)
3434

3535
app.configure do |config|
3636
config.adapter = :WEBrick
37-
config.adapter_options = {AccessLog: [], Logger: Logger.new('/dev/null')}
37+
config.adapter_options = {AccessLog: [], Logger: Logger.new(File::NULL)}
3838
end
3939
end
4040

lib/webmachine/adapters/webrick.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def run
2929
class Server < ::WEBrick::HTTPServer
3030
def initialize(options)
3131
@application = options[:application]
32-
super(options)
32+
super
3333
end
3434

3535
# Handles a request

lib/webmachine/etags.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module Webmachine
55
# This class by itself represents a "strong" entity tag.
66
class ETag
77
include QuotedString
8+
89
# The pattern for a weak entity tag
910
WEAK_ETAG = /^W\/#{QUOTED_STRING}$/.freeze
1011

lib/webmachine/headers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def self.from_cgi(env)
3232
# @param [Object]
3333
# @return [Webmachine::Headers]
3434
def self.[](*args)
35-
super(super(*args).map { |k, v| [k.to_s.downcase, v] })
35+
super(super.map { |k, v| [k.to_s.downcase, v] })
3636
end
3737

3838
# Fetch a header

lib/webmachine/media_type.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module Webmachine
66
# Encapsulates a MIME media type, with logic for matching types.
77
class MediaType
88
extend Translation
9+
910
# Matches valid media types
1011
MEDIA_TYPE_REGEX = /^\s*([^;\s]+)\s*((?:;\s*\S+\s*)*)\s*$/.freeze
1112

@@ -112,11 +113,8 @@ def minor
112113
# ignoring params and taking into account wildcards
113114
def type_matches?(other)
114115
other = self.class.parse(other)
115-
if [Dispatcher::Route::MATCH_ALL_STR, MATCHES_ALL, type].include?(other.type)
116-
true
117-
else
118-
other.major == major && other.minor == Dispatcher::Route::MATCH_ALL_STR
119-
end
116+
[Dispatcher::Route::MATCH_ALL_STR, MATCHES_ALL, type].include?(other.type) ||
117+
(other.major == major && other.minor == Dispatcher::Route::MATCH_ALL_STR)
120118
end
121119
end # class MediaType
122120
end # module Webmachine

lib/webmachine/streaming/io_encoder.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module Streaming
77
# @api private
88
class IOEncoder < Encoder
99
include Enumerable
10+
1011
CHUNK_SIZE = 8192
1112
# Iterates over the IO, encoding and yielding individual chunks
1213
# of the response entity.

spec/webmachine/resource/authentication_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def to_html
2323
let(:resource) do
2424
resource_with do
2525
include Webmachine::Resource::Authentication
26+
2627
attr_accessor :realm
2728
def is_authorized?(auth)
2829
basic_auth(auth, @realm || 'Webmachine') { |u, p| u == 'webmachine' && p == 'http' }

0 commit comments

Comments
 (0)