domain_extractor 0.1.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +25 -15
- data/lib/domain_extractor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9be08df3b44102d414007ad7fc6865166cb89061a09340d5e49de211165c963f
|
|
4
|
+
data.tar.gz: a334da0e7a8dc42335b9710aaf9d601d9fc85323ca2e328359de9593a340abc3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 297852adc140faba6fc64b7589402c1f3b032be344d13ad781ede5ff2a1c1ba867480edbebaca488708da46d68152bf3ee80c02da36d6f8afbf97a74361960ae
|
|
7
|
+
data.tar.gz: 6b0191d8bfb2458a23e3c56c382f495c9eebf86715a16c8f2936e6804d4adc0643835485e100e42f3bcd3f4d83344d7d60aac47dee60f72214fd95297f714334
|
data/README.md
CHANGED
|
@@ -78,6 +78,7 @@ DomainExtractor now returns a `ParsedURL` object that supports three accessor st
|
|
|
78
78
|
### Method Accessor Styles
|
|
79
79
|
|
|
80
80
|
#### 1. Default Methods (Silent Nil)
|
|
81
|
+
|
|
81
82
|
Returns the value or `nil` - perfect for exploratory code or when handling invalid data gracefully.
|
|
82
83
|
|
|
83
84
|
```ruby
|
|
@@ -93,6 +94,7 @@ result.domain # => 'example'
|
|
|
93
94
|
```
|
|
94
95
|
|
|
95
96
|
#### 2. Bang Methods (!) - Explicit Errors
|
|
97
|
+
|
|
96
98
|
Returns the value or raises `InvalidURLError` - ideal for production code where missing data should fail fast.
|
|
97
99
|
|
|
98
100
|
```ruby
|
|
@@ -102,6 +104,7 @@ result.subdomain! # raises InvalidURLError: "subdomain not found or invalid"
|
|
|
102
104
|
```
|
|
103
105
|
|
|
104
106
|
#### 3. Question Methods (?) - Boolean Checks
|
|
107
|
+
|
|
105
108
|
Always returns `true` or `false` - perfect for conditional logic without exceptions.
|
|
106
109
|
|
|
107
110
|
```ruby
|
|
@@ -261,7 +264,7 @@ hash = result.to_h
|
|
|
261
264
|
# }
|
|
262
265
|
```
|
|
263
266
|
|
|
264
|
-
**
|
|
267
|
+
**[Comprehensive documentation and real-world examples of parsed URL quick start guide](https://github.com/opensite-ai/domain_extractor/blob/master/docs/PARSED_URL_QUICK_START.md)**
|
|
265
268
|
|
|
266
269
|
## Usage Examples
|
|
267
270
|
|
|
@@ -326,31 +329,38 @@ DomainExtractor.parse('not-a-url')
|
|
|
326
329
|
|
|
327
330
|
## API Reference
|
|
328
331
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
Parses a URL string and extracts domain components.
|
|
332
|
+
```ruby
|
|
333
|
+
DomainExtractor.parse(url_string)
|
|
332
334
|
|
|
333
|
-
|
|
335
|
+
# => Parses a URL string and extracts domain components.
|
|
334
336
|
|
|
335
|
-
|
|
337
|
+
# Returns: Hash with keys :subdomain, :domain, :tld, :root_domain, :host, :path
|
|
338
|
+
# Raises: DomainExtractor::InvalidURLError when the URL fails validation
|
|
339
|
+
```
|
|
336
340
|
|
|
337
|
-
|
|
341
|
+
```ruby
|
|
342
|
+
DomainExtractor.parse_batch(urls)
|
|
338
343
|
|
|
339
|
-
Parses multiple URLs efficiently.
|
|
344
|
+
# => Parses multiple URLs efficiently.
|
|
340
345
|
|
|
341
|
-
|
|
346
|
+
# Returns: Array of parsed results
|
|
347
|
+
```
|
|
342
348
|
|
|
343
|
-
|
|
349
|
+
```ruby
|
|
350
|
+
DomainExtractor.valid?(url_string)
|
|
344
351
|
|
|
345
|
-
Checks if a URL can be parsed successfully without raising.
|
|
352
|
+
# => Checks if a URL can be parsed successfully without raising.
|
|
346
353
|
|
|
347
|
-
|
|
354
|
+
# Returns: true or false
|
|
355
|
+
```
|
|
348
356
|
|
|
349
|
-
|
|
357
|
+
```ruby
|
|
358
|
+
DomainExtractor.parse_query_params(query_string)
|
|
350
359
|
|
|
351
|
-
Parses a query string into a hash of parameters.
|
|
360
|
+
# => Parses a query string into a hash of parameters.
|
|
352
361
|
|
|
353
|
-
|
|
362
|
+
# Returns: Hash of query parameters
|
|
363
|
+
```
|
|
354
364
|
|
|
355
365
|
## Use Cases
|
|
356
366
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: domain_extractor
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OpenSite AI
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-11-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: public_suffix
|