From bfa79ffed519b674fca982b28b7412330e803a59 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Wed, 22 Jan 2025 11:00:33 +1300 Subject: [PATCH] RuboCop. --- lib/protocol/http/header/accept.rb | 6 +++--- lib/protocol/http/header/quoted_string.rb | 2 +- test/protocol/http/header/accept.rb | 4 ++-- test/protocol/http/header/accept_charset.rb | 4 ++-- test/protocol/http/header/accept_encoding.rb | 4 ++-- test/protocol/http/header/accept_language.rb | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/protocol/http/header/accept.rb b/lib/protocol/http/header/accept.rb index 2d688bd..24356e7 100644 --- a/lib/protocol/http/header/accept.rb +++ b/lib/protocol/http/header/accept.rb @@ -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 @@ -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)}" @@ -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) diff --git a/lib/protocol/http/header/quoted_string.rb b/lib/protocol/http/header/quoted_string.rb index d243c50..f69edbe 100644 --- a/lib/protocol/http/header/quoted_string.rb +++ b/lib/protocol/http/header/quoted_string.rb @@ -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 diff --git a/test/protocol/http/header/accept.rb b/test/protocol/http/header/accept.rb index 3aa9593..865ee68 100644 --- a/test/protocol/http/header/accept.rb +++ b/test/protocol/http/header/accept.rb @@ -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 diff --git a/test/protocol/http/header/accept_charset.rb b/test/protocol/http/header/accept_charset.rb index d26bd7f..9de461a 100644 --- a/test/protocol/http/header/accept_charset.rb +++ b/test/protocol/http/header/accept_charset.rb @@ -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 diff --git a/test/protocol/http/header/accept_encoding.rb b/test/protocol/http/header/accept_encoding.rb index a5f8908..5255c19 100644 --- a/test/protocol/http/header/accept_encoding.rb +++ b/test/protocol/http/header/accept_encoding.rb @@ -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 diff --git a/test/protocol/http/header/accept_language.rb b/test/protocol/http/header/accept_language.rb index e094d40..2b9b243 100644 --- a/test/protocol/http/header/accept_language.rb +++ b/test/protocol/http/header/accept_language.rb @@ -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