Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Net::HTTPHeader#each_value
each_value() { |value| ... }
lib/net/http/header.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.3.0/lib/net/http/header.rb, line 438
def each_value #:yield: +value+
block_given? or return enum_for(__method__) { @header.size }
@header.each_value do |va|
yield va.join(', ')
end
end
Calls the block with each string field value:
Example
res = Net::HTTP.get_response(hostname, '/todos/1') res.each_value do |value| p value if value.start_with?('c') end
Output:
Example
"chunked" "cf-q-config;dur=6.0000002122251e-06" "cloudflare"
Returns an enumerator if no block is given.