Module: DomainExtractor::Result
- Defined in:
- lib/domain_extractor/result.rb
Overview
Result encapsulates the final parsed attributes and exposes a hash interface.
Constant Summary collapse
- EMPTY_PATH =
Frozen constants for zero allocation
''- EMPTY_HASH =
{}.freeze
Class Method Summary collapse
Class Method Details
.build(**attributes) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/domain_extractor/result.rb', line 14 def build(**attributes) hash = { subdomain: normalize_subdomain(attributes[:subdomain]), root_domain: attributes[:root_domain], domain: attributes[:domain], tld: attributes[:tld], host: attributes[:host], path: attributes[:path] || EMPTY_PATH, query_params: QueryParams.call(attributes[:query]) }.freeze ParsedURL.new(hash) end |