File tree Expand file tree Collapse file tree 6 files changed +8
-14
lines changed
Expand file tree Collapse file tree 6 files changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ module Protocol
1212 module HTTP
1313 module Header
1414 # The `accept-content-type` header represents a list of content-types that the client can accept.
15- class Accept < Array
15+ class Accept < Split
1616 # Regular expression used to split values on commas, with optional surrounding whitespace, taking into account quoted strings.
1717 SEPARATOR = /
1818 (?: # Start non-capturing group
@@ -83,7 +83,7 @@ def self.parse(value)
8383 def self . coerce ( value )
8484 case value
8585 when Array
86- self . new ( value )
86+ self . new ( value . map ( & :to_s ) )
8787 else
8888 self . parse ( value . to_s )
8989 end
@@ -96,9 +96,7 @@ def initialize(value = nil)
9696 if value . is_a? ( Array )
9797 super ( value )
9898 elsif value . is_a? ( String )
99- # Compatibility with the old constructor, prefer to use `parse` instead:
100- super ( )
101- self << value
99+ super ( value )
102100 elsif value
103101 raise ArgumentError , "Invalid value: #{ value . inspect } "
104102 end
Original file line number Diff line number Diff line change @@ -30,8 +30,7 @@ def initialize(value = nil)
3030 super ( value . map ( &:downcase ) )
3131 elsif value . is_a? ( String )
3232 # Compatibility with the old constructor, prefer to use `parse` instead:
33- super ( )
34- self << value
33+ super ( value )
3534 elsif value
3635 raise ArgumentError , "Invalid value: #{ value . inspect } "
3736 end
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ def self.parse(value)
2929 def self . coerce ( value )
3030 case value
3131 when Array
32- self . new ( value )
32+ self . new ( value . map ( & :to_s ) )
3333 else
3434 self . parse ( value . to_s )
3535 end
Original file line number Diff line number Diff line change @@ -70,8 +70,7 @@ def initialize(value = nil)
7070 super ( value . map ( &:downcase ) )
7171 elsif value . is_a? ( String )
7272 # Compatibility with the old constructor, prefer to use `parse` instead:
73- super ( )
74- self << value
73+ super ( value )
7574 elsif value
7675 raise ArgumentError , "Invalid value: #{ value . inspect } "
7776 end
Original file line number Diff line number Diff line change @@ -35,8 +35,7 @@ def initialize(value = nil)
3535 super ( value . map ( &:downcase ) )
3636 elsif value . is_a? ( String )
3737 # Compatibility with the old constructor, prefer to use `parse` instead:
38- super ( )
39- self << value
38+ super ( value )
4039 elsif value
4140 raise ArgumentError , "Invalid value: #{ value . inspect } "
4241 end
Original file line number Diff line number Diff line change @@ -20,8 +20,7 @@ def initialize(value = nil)
2020 super ( value . map ( &:downcase ) )
2121 elsif value . is_a? ( String )
2222 # Compatibility with the old constructor, prefer to use `parse` instead:
23- super ( )
24- self << value
23+ super ( value )
2524 elsif value
2625 raise ArgumentError , "Invalid value: #{ value . inspect } "
2726 end
You can’t perform that action at this time.
0 commit comments