mirror of
https://github.com/samsonjs/http-cookie.git
synced 2026-03-25 08:55:53 +00:00
Merge pull request #47 from sparklemotion/flavorjones-ruby-3.4-warnings
quash ruby 3.4 warnings
This commit is contained in:
commit
6b2ffb6fc4
5 changed files with 15 additions and 11 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
# :markup: markdown
|
# :markup: markdown
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'http/cookie/version'
|
require 'http/cookie/version'
|
||||||
require 'http/cookie/uri_parser'
|
require 'http/cookie/uri_parser'
|
||||||
require 'time'
|
require 'time'
|
||||||
|
|
@ -425,7 +426,7 @@ class HTTP::Cookie
|
||||||
# Returns the domain, with a dot prefixed only if the domain flag is
|
# Returns the domain, with a dot prefixed only if the domain flag is
|
||||||
# on.
|
# on.
|
||||||
def dot_domain
|
def dot_domain
|
||||||
@for_domain ? '.' << @domain : @domain
|
@for_domain ? (+'.') << @domain : @domain
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the domain attribute value as a DomainName object.
|
# Returns the domain attribute value as a DomainName object.
|
||||||
|
|
@ -595,7 +596,7 @@ class HTTP::Cookie
|
||||||
# Returns a string for use in the Cookie header, i.e. `name=value`
|
# Returns a string for use in the Cookie header, i.e. `name=value`
|
||||||
# or `name="value"`.
|
# or `name="value"`.
|
||||||
def cookie_value
|
def cookie_value
|
||||||
"#{@name}=#{Scanner.quote(@value)}"
|
+"#{@name}=#{Scanner.quote(@value)}"
|
||||||
end
|
end
|
||||||
alias to_s cookie_value
|
alias to_s cookie_value
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'http/cookie'
|
require 'http/cookie'
|
||||||
require 'strscan'
|
require 'strscan'
|
||||||
require 'time'
|
require 'time'
|
||||||
|
|
@ -23,7 +24,7 @@ class HTTP::Cookie::Scanner < StringScanner
|
||||||
class << self
|
class << self
|
||||||
def quote(s)
|
def quote(s)
|
||||||
return s unless s.match(RE_BAD_CHAR)
|
return s unless s.match(RE_BAD_CHAR)
|
||||||
'"' << s.gsub(/([\\"])/, "\\\\\\1") << '"'
|
(+'"') << s.gsub(/([\\"])/, "\\\\\\1") << '"'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -32,7 +33,7 @@ class HTTP::Cookie::Scanner < StringScanner
|
||||||
end
|
end
|
||||||
|
|
||||||
def scan_dquoted
|
def scan_dquoted
|
||||||
''.tap { |s|
|
(+'').tap { |s|
|
||||||
case
|
case
|
||||||
when skip(/"/)
|
when skip(/"/)
|
||||||
break
|
break
|
||||||
|
|
@ -51,7 +52,7 @@ class HTTP::Cookie::Scanner < StringScanner
|
||||||
end
|
end
|
||||||
|
|
||||||
def scan_value(comma_as_separator = false)
|
def scan_value(comma_as_separator = false)
|
||||||
''.tap { |s|
|
(+'').tap { |s|
|
||||||
case
|
case
|
||||||
when scan(/[^,;"]+/)
|
when scan(/[^,;"]+/)
|
||||||
s << matched
|
s << matched
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ module Test
|
||||||
module Unit
|
module Unit
|
||||||
module Assertions
|
module Assertions
|
||||||
def assert_warn(pattern, message = nil, &block)
|
def assert_warn(pattern, message = nil, &block)
|
||||||
class << (output = "")
|
class << (output = +"")
|
||||||
alias write <<
|
alias write <<
|
||||||
end
|
end
|
||||||
stderr, $stderr = $stderr, output
|
stderr, $stderr = $stderr, output
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
# frozen_string_literal: false
|
||||||
require File.expand_path('helper', File.dirname(__FILE__))
|
require File.expand_path('helper', File.dirname(__FILE__))
|
||||||
require 'psych' if !defined?(YAML) && RUBY_VERSION == "1.9.2"
|
require 'psych' if !defined?(YAML) && RUBY_VERSION == "1.9.2"
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
|
|
@ -757,7 +758,7 @@ class TestHTTPCookie < Test::Unit::TestCase
|
||||||
assert_equal 12, cookie.max_age
|
assert_equal 12, cookie.max_age
|
||||||
|
|
||||||
cookie.max_age = -3
|
cookie.max_age = -3
|
||||||
assert_equal -3, cookie.max_age
|
assert_equal(-3, cookie.max_age)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_session
|
def test_session
|
||||||
|
|
@ -1016,7 +1017,7 @@ class TestHTTPCookie < Test::Unit::TestCase
|
||||||
'https://www.example.com/dir2/test.html',
|
'https://www.example.com/dir2/test.html',
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
HTTP::Cookie.parse('a4=b; domain=example.com; path=/dir2/',
|
HTTP::Cookie.parse('a3=b; domain=example.com; path=/dir2/',
|
||||||
URI('http://example.com/dir/file.html')).first => {
|
URI('http://example.com/dir/file.html')).first => {
|
||||||
true => [
|
true => [
|
||||||
'https://example.com/dir2/test.html',
|
'https://example.com/dir2/test.html',
|
||||||
|
|
@ -1044,7 +1045,7 @@ class TestHTTPCookie < Test::Unit::TestCase
|
||||||
'file:///dir2/test.html',
|
'file:///dir2/test.html',
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
HTTP::Cookie.parse('a4=b; secure',
|
HTTP::Cookie.parse('a5=b; secure',
|
||||||
URI('https://example.com/dir/file.html')).first => {
|
URI('https://example.com/dir/file.html')).first => {
|
||||||
true => [
|
true => [
|
||||||
'https://example.com/dir/test.html',
|
'https://example.com/dir/test.html',
|
||||||
|
|
@ -1056,7 +1057,7 @@ class TestHTTPCookie < Test::Unit::TestCase
|
||||||
'file:///dir2/test.html',
|
'file:///dir2/test.html',
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
HTTP::Cookie.parse('a5=b',
|
HTTP::Cookie.parse('a6=b',
|
||||||
URI('https://example.com/')).first => {
|
URI('https://example.com/')).first => {
|
||||||
true => [
|
true => [
|
||||||
'https://example.com',
|
'https://example.com',
|
||||||
|
|
@ -1065,7 +1066,7 @@ class TestHTTPCookie < Test::Unit::TestCase
|
||||||
'file:///',
|
'file:///',
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
HTTP::Cookie.parse('a6=b; path=/dir',
|
HTTP::Cookie.parse('a7=b; path=/dir',
|
||||||
'http://example.com/dir/file.html').first => {
|
'http://example.com/dir/file.html').first => {
|
||||||
true => [
|
true => [
|
||||||
'http://example.com/dir',
|
'http://example.com/dir',
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: false
|
||||||
require File.expand_path('helper', File.dirname(__FILE__))
|
require File.expand_path('helper', File.dirname(__FILE__))
|
||||||
require 'tmpdir'
|
require 'tmpdir'
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue