prompt-lists 0.0.1 → 0.0.3
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/Gemfile.lock +1 -1
- data/README.md +10 -1
- data/lib/prompt_lists.rb +24 -20
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 470a9a2e1784148f8e3f564e148858b5d6d2282ac0c5be577cdb82b142292f1c
|
4
|
+
data.tar.gz: 4a9cc2d872bd350372562a38722c51706be6600d3abc8ae01a92bf53709dd77d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b224390cb3c7acf9b0a925de3da24edb62842219e92a132369f67128da1dd71af2b7c6365e9ab4df4216e5c22a55c9a641068773e340fd63b1c2dedbf9bd2dee
|
7
|
+
data.tar.gz: e4b1ecd1cd6d03e3f6001837115c5946e008ec7231f822d82038e7978ac23d78c8cdee7d601e1fc5971b224f7390dffb0ce351ac666a2e8b2e537388c1b62f93
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -6,4 +6,13 @@ generation on [PROMPTCACHE](https://promptcache.com).
|
|
6
6
|
## Installation
|
7
7
|
|
8
8
|
```ruby
|
9
|
-
gem "prompt-lists"
|
9
|
+
gem "prompt-lists", require: 'prompt_lists'
|
10
|
+
```
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
You can retrieve items like so:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
PromptLists.photography.camera.items
|
18
|
+
```
|
data/lib/prompt_lists.rb
CHANGED
@@ -3,27 +3,26 @@
|
|
3
3
|
require 'yaml'
|
4
4
|
|
5
5
|
module PromptLists
|
6
|
-
VERSION = '0.0.
|
6
|
+
VERSION = '0.0.3'
|
7
7
|
|
8
8
|
class List
|
9
|
-
def initialize(
|
10
|
-
@
|
11
|
-
|
12
|
-
Hash[id, file_path]
|
13
|
-
end
|
9
|
+
def initialize(list_name, sublist_names)
|
10
|
+
@id = list_name.to_sym
|
11
|
+
@sublists = sublist_names
|
14
12
|
end
|
15
13
|
|
16
14
|
def method_missing(method_name, *args)
|
17
|
-
sublist = @sublists.find { |sublist| sublist
|
15
|
+
sublist = @sublists.find { |sublist| sublist == method_name }
|
18
16
|
if sublist
|
19
|
-
|
17
|
+
path = File.expand_path("../lists/#{@id}/#{sublist}.yml", __dir__)
|
18
|
+
Sublist.new(path)
|
20
19
|
else
|
21
20
|
super
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
25
24
|
def respond_to_missing?(method_name, include_private = false)
|
26
|
-
sublist = @sublists.find { |sublist| sublist
|
25
|
+
sublist = @sublists.find { |sublist| sublist == method_name }
|
27
26
|
sublist || super
|
28
27
|
end
|
29
28
|
end
|
@@ -42,28 +41,33 @@ module PromptLists
|
|
42
41
|
end
|
43
42
|
|
44
43
|
class << self
|
45
|
-
def
|
46
|
-
|
44
|
+
def all
|
45
|
+
Dir[File.expand_path("../lists/*", __dir__)].map do |list|
|
46
|
+
list_name = File.basename(list)
|
47
|
+
List.new(list_name, load_sublists(list_name))
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def find(list_name)
|
47
52
|
if list_exists?(list_name)
|
48
|
-
|
49
|
-
List.new(result)
|
50
|
-
else
|
51
|
-
super
|
53
|
+
List.new(list_name, load_sublists(list_name))
|
52
54
|
end
|
53
55
|
end
|
54
56
|
|
55
|
-
def
|
56
|
-
|
57
|
+
def method_missing(method_name, *args)
|
58
|
+
find(method_name) || super
|
57
59
|
end
|
58
60
|
|
59
61
|
private
|
60
62
|
|
61
|
-
def
|
62
|
-
Dir["lists/#{list_name}/*.yml"]
|
63
|
+
def load_sublists(list_name)
|
64
|
+
Dir[File.expand_path("../lists/#{list_name}/*.yml", __dir__)].map do |file_path|
|
65
|
+
File.basename(file_path, ".yml").gsub(/-/, "_").to_sym
|
66
|
+
end
|
63
67
|
end
|
64
68
|
|
65
69
|
def list_exists?(list_name)
|
66
|
-
Dir.exist?("lists/#{list_name}")
|
70
|
+
Dir.exist?(File.expand_path("../lists/#{list_name}", __dir__))
|
67
71
|
end
|
68
72
|
end
|
69
73
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prompt-lists
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dreaming Tulpa
|
@@ -270,11 +270,11 @@ files:
|
|
270
270
|
- lists/word/adverb.yml
|
271
271
|
- lists/word/noun.yml
|
272
272
|
- lists/word/verb.yml
|
273
|
-
homepage: https://
|
273
|
+
homepage: https://promptcache.com
|
274
274
|
licenses:
|
275
275
|
- MIT
|
276
276
|
metadata:
|
277
|
-
homepage_uri: https://
|
277
|
+
homepage_uri: https://promptcache.com
|
278
278
|
source_code_uri: https://github.com/dreamingtulpa/prompt-lists
|
279
279
|
changelog_uri: https://github.com/dreamingtulpa/prompt-lists/blob/master/CHANGELOG.md
|
280
280
|
post_install_message:
|
@@ -295,5 +295,5 @@ requirements: []
|
|
295
295
|
rubygems_version: 3.4.10
|
296
296
|
signing_key:
|
297
297
|
specification_version: 4
|
298
|
-
summary: Categorised lists of things for AI image and media generation.
|
298
|
+
summary: Categorised lists of things for AI image and media generation on promptcache.com.
|
299
299
|
test_files: []
|