lib/protocol/http/cookie.rb in protocol-http-0.36.0 vs lib/protocol/http/cookie.rb in protocol-http-0.37.0

- old
+ new

@@ -2,11 +2,11 @@ # Released under the MIT License. # Copyright, 2019-2023, by Samuel Williams. # Copyright, 2022, by Herrick Fang. -require_relative 'url' +require_relative "url" module Protocol module HTTP # Represents an individual cookie key-value pair. class Cookie @@ -29,19 +29,19 @@ end def to_s buffer = String.new.b - buffer << encoded_name << '=' << encoded_value + buffer << encoded_name << "=" << encoded_value if @directives @directives.collect do |key, value| - buffer << ';' + buffer << ";" case value when String - buffer << key << '=' << value + buffer << key << "=" << value when TrueClass buffer << key end end end @@ -50,11 +50,11 @@ end def self.parse(string) head, *directives = string.split(/\s*;\s*/) - key, value = head.split('=', 2) + key, value = head.split("=", 2) directives = self.parse_directives(directives) self.new( URL.unescape(key), URL.unescape(value), @@ -62,10 +62,10 @@ ) end def self.parse_directives(strings) strings.collect do |string| - key, value = string.split('=', 2) + key, value = string.split("=", 2) [key, value || true] end.to_h end end end