philiprehberger-random_data 0.3.0 → 0.4.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/CHANGELOG.md +5 -0
- data/README.md +8 -0
- data/lib/philiprehberger/random_data/version.rb +1 -1
- data/lib/philiprehberger/random_data.rb +12 -0
- 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: 66b3892c4c67cf116d9f415c2f15f9351e9fc9ecc907fcd052d93db04c2da69c
|
|
4
|
+
data.tar.gz: 25f7bd4d5907d4350dc5d9381781b6c47f694e4df593c48ef80347147fd97ad8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4ea172d1596e1f5c28aa06cef63822fec2202f4a176c526f4f132a5aedd13bbb0db6bda54740ef11fbfbbafb6242e7b2693cc22f89e1a547fb09cf3fa241ccd7
|
|
7
|
+
data.tar.gz: 127842bc07223d27f397348d79ebec2dda96e32a588b13119748070bb89054b9719714e6744c33a3b0e57df82eda1eca154c7ebc116474a628e397e3da611367
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.4.0] - 2026-04-24
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `RandomData.coordinates` — returns a `{ latitude:, longitude: }` hash with latitude in `-90.0..90.0` and longitude in `-180.0..180.0`
|
|
14
|
+
|
|
10
15
|
## [0.3.0] - 2026-04-16
|
|
11
16
|
|
|
12
17
|
### Added
|
data/README.md
CHANGED
|
@@ -78,6 +78,13 @@ Philiprehberger::RandomData.ipv4 # => "192.45.67.123"
|
|
|
78
78
|
Philiprehberger::RandomData.url # => "https://smith42.com"
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
+
### Coordinates
|
|
82
|
+
|
|
83
|
+
```ruby
|
|
84
|
+
Philiprehberger::RandomData.coordinates
|
|
85
|
+
# => { latitude: 42.7651, longitude: -87.3419 }
|
|
86
|
+
```
|
|
87
|
+
|
|
81
88
|
### Address and Company
|
|
82
89
|
|
|
83
90
|
```ruby
|
|
@@ -117,6 +124,7 @@ Philiprehberger::RandomData.timestamp # => 2025-08-14 03:22:11 +0000
|
|
|
117
124
|
| `RandomData.sample(array, n)` | Random n elements from array |
|
|
118
125
|
| `RandomData.weighted_pick(array, weights:)` | Random element chosen proportionally to matching weights |
|
|
119
126
|
| `RandomData.ipv4` | Random IPv4 address |
|
|
127
|
+
| `RandomData.coordinates` | Random `{ latitude:, longitude: }` pair |
|
|
120
128
|
| `RandomData.address` | Random address hash with street, city, state, zip |
|
|
121
129
|
| `RandomData.company` | Random company name |
|
|
122
130
|
| `RandomData.url` | Random URL |
|
|
@@ -151,6 +151,18 @@ module Philiprehberger
|
|
|
151
151
|
Array.new(4) { rand(1..254) }.join('.')
|
|
152
152
|
end
|
|
153
153
|
|
|
154
|
+
# Generate a random geographic coordinate pair.
|
|
155
|
+
#
|
|
156
|
+
# Latitude is drawn uniformly from `-90.0..90.0` and longitude from
|
|
157
|
+
# `-180.0..180.0`. The distribution is not area-weighted — it samples
|
|
158
|
+
# the latitude axis uniformly, not over a sphere — which is usually
|
|
159
|
+
# what test fixtures want.
|
|
160
|
+
#
|
|
161
|
+
# @return [Hash{Symbol => Float}] `{ latitude:, longitude: }`
|
|
162
|
+
def self.coordinates
|
|
163
|
+
{ latitude: float(-90.0..90.0), longitude: float(-180.0..180.0) }
|
|
164
|
+
end
|
|
165
|
+
|
|
154
166
|
# Generate a random address
|
|
155
167
|
#
|
|
156
168
|
# @return [Hash] address with street, city, state, zip
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: philiprehberger-random_data
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Philip Rehberger
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-04-
|
|
11
|
+
date: 2026-04-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Generate random test data including names, emails, phone numbers, UUIDs,
|
|
14
14
|
sentences, paragraphs, dates, numbers, and more. Includes 50 first names, 50 last
|