Module: Philiprehberger::Etag::Parser
- Defined in:
- lib/philiprehberger/etag/parser.rb
Overview
Parses ETag header values into structured data.
Class Method Summary collapse
-
.parse(header) ⇒ Hash+
Parses an ETag header value into a hash or array of hashes.
Class Method Details
.parse(header) ⇒ Hash+
Parses an ETag header value into a hash or array of hashes. Handles single ETags, comma-separated lists, weak validators, and quoted strings.
13 14 15 16 17 18 19 20 |
# File 'lib/philiprehberger/etag/parser.rb', line 13 def self.parse(header) return { weak: false, value: '' } if header.nil? || header.strip.empty? = (header) parsed = .map { |raw| parse_single(raw) } parsed.length == 1 ? parsed.first : parsed end |