Skip to content

Commit

Permalink
RuboCop.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Jan 21, 2025
1 parent c4189aa commit bfa79ff
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions lib/protocol/http/header/accept.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Accept < Array

# A single entry in the Accept: header, which includes a mime type and associated parameters.
MediaRange = Struct.new(:type, :subtype, :parameters) do
def initialize(type, subtype = '*', parameters = {})
def initialize(type, subtype = "*", parameters = {})
super(type, subtype, parameters)
end

Expand All @@ -39,7 +39,7 @@ def <=> other
end

def parameters_string
return '' if parameters == nil or parameters.empty?
return "" if parameters == nil or parameters.empty?

parameters.collect do |key, value|
"; #{key.to_s}=#{QuotedString.quote(value.to_s)}"
Expand All @@ -65,7 +65,7 @@ def to_s
alias to_str to_s

def quality_factor
parameters.fetch('q', 1.0).to_f
parameters.fetch("q", 1.0).to_f
end

def split(*args)
Expand Down
2 changes: 1 addition & 1 deletion lib/protocol/http/header/quoted_string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def self.unquote(value, normalize_whitespace = true)

if normalize_whitespace
# LWS = [CRLF] 1*( SP | HT )
value.gsub!(/[\r\n]+\s+/, ' ')
value.gsub!(/[\r\n]+\s+/, " ")
end

return value
Expand Down
4 changes: 2 additions & 2 deletions test/protocol/http/header/accept.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.

require 'protocol/http/header/accept'
require "protocol/http/header/accept"

describe Protocol::HTTP::Header::Accept::MediaRange do
it "should have default quality_factor of 1.0" do
language = subject.new('text/plain', nil)
language = subject.new("text/plain", nil)
expect(language.quality_factor).to be == 1.0
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/protocol/http/header/accept_charset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.

require 'protocol/http/header/accept_charset'
require "protocol/http/header/accept_charset"

describe Protocol::HTTP::Header::AcceptCharset::Charset do
it "should have default quality_factor of 1.0" do
charset = subject.new('utf-8', nil)
charset = subject.new("utf-8", nil)
expect(charset.quality_factor).to be == 1.0
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/protocol/http/header/accept_encoding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.

require 'protocol/http/header/accept_encoding'
require "protocol/http/header/accept_encoding"

describe Protocol::HTTP::Header::AcceptEncoding::Encoding do
it "should have default quality_factor of 1.0" do
encoding = subject.new('utf-8', nil)
encoding = subject.new("utf-8", nil)
expect(encoding.quality_factor).to be == 1.0
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/protocol/http/header/accept_language.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.

require 'protocol/http/header/accept_language'
require "protocol/http/header/accept_language"

describe Protocol::HTTP::Header::AcceptLanguage::Language do
it "should have default quality_factor of 1.0" do
language = subject.new('utf-8', nil)
language = subject.new("utf-8", nil)
expect(language.quality_factor).to be == 1.0
end
end
Expand Down

0 comments on commit bfa79ff

Please sign in to comment.