eunomia_gen 0.1.5 → 0.1.6
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 +27 -0
- data/lib/eunomia/generator.rb +2 -0
- data/lib/eunomia/result.rb +1 -1
- data/lib/eunomia/segment/reference.rb +1 -1
- data/lib/eunomia/store.rb +3 -0
- data/lib/eunomia/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: dda6a6807dc92353a11e090f8d61cbeb238510a8a7a0f6d524e9a90328192317
|
4
|
+
data.tar.gz: 0b54749ea476821a8511a355d6ddce2591128bc2417f60f8161d2405120708c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b624e0b5f19812df73cacf9bf2abab0d55078f78cf5adc6d50eac078feb6d3bdce34d2e0ba5b2b9bae1d005a7049b971465399dd142b5c29dac876e49a048aa8
|
7
|
+
data.tar.gz: ea823e74de17872ec4706c6648319f425e11ec9a25cf6c9581872c942d21af08495aab34e2b47f0c21142c4154759c618f00059b29674dad5196d3c5aa59496b
|
data/README.md
CHANGED
@@ -125,6 +125,33 @@ If the first segment is not a number the multiplier defaults to 1.
|
|
125
125
|
A constant hash can be added to the request. A string that matches the hash key will be replaced by the
|
126
126
|
constant value.
|
127
127
|
|
128
|
+
### Tags and Filtering
|
129
|
+
|
130
|
+
Tags can be used to filter items. For example, some plant names are also used as names. So a list of
|
131
|
+
plants could be filtered to only those that are also names to generate a character name. Tags assigned
|
132
|
+
to an item are also added as metadat to the result if the tag is in `key:value` format.
|
133
|
+
|
134
|
+
```ruby
|
135
|
+
data = [
|
136
|
+
{ key: "plant", items: %w[[flower] [tree]] },
|
137
|
+
{ key: "flower", items: [
|
138
|
+
{ segments: "rose", tags: %w[name:plant] },
|
139
|
+
{ segments: "hydrangea" }
|
140
|
+
]
|
141
|
+
},
|
142
|
+
{ key: "tree", items: [
|
143
|
+
{ segments: "ash", tags: %w[name:plant] },
|
144
|
+
{ segments: "oak" }
|
145
|
+
]
|
146
|
+
}
|
147
|
+
]
|
148
|
+
|
149
|
+
Eunomia.add(data)
|
150
|
+
val = Eunomia.generate("plant", tags: %w[name:plant], functions: ["capitalize"])
|
151
|
+
p val.to_s # => "Rose" or "Ash"
|
152
|
+
p val.meta # => { "tag" => "name:plant" }
|
153
|
+
```
|
154
|
+
|
128
155
|
## Development
|
129
156
|
|
130
157
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec`
|
data/lib/eunomia/generator.rb
CHANGED
@@ -7,6 +7,7 @@ module Eunomia
|
|
7
7
|
include Eunomia::HashHelpers
|
8
8
|
|
9
9
|
attr_reader :key,
|
10
|
+
:aliases,
|
10
11
|
:alts,
|
11
12
|
:meta,
|
12
13
|
:functions,
|
@@ -17,6 +18,7 @@ module Eunomia
|
|
17
18
|
|
18
19
|
def initialize(hsh)
|
19
20
|
@key = field_or_raise(hsh, :key)
|
21
|
+
@aliases = list_field(hsh, :aliases)
|
20
22
|
@functions = list_field(hsh, :functions)
|
21
23
|
@alts = hash_field(hsh, :alts)
|
22
24
|
@meta = meta_field(hsh)
|
data/lib/eunomia/result.rb
CHANGED
data/lib/eunomia/store.rb
CHANGED
data/lib/eunomia/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eunomia_gen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- G Palmer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Create random string with a focus on RPGs similar to fantasynamegenerators.com
|
14
14
|
email:
|