prompt-lists 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/prompt_lists.rb +16 -5
- 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: 1081fe5953e84622f8d0a63263278649d9fbb86da553c0651993c31a155a597d
|
4
|
+
data.tar.gz: c1a7c7e0655eff637358ea805d52dab76d149d8bee0513d6549987eaeaf0dd4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81b1bb8bf974b77490ee745f99bf10c69829c0a406ee198bbada2f70ed6966531ea0c77d24c3fedff2c0d1429dccf9c0e2ca5bcbc436b13f1750b76b7241b618
|
7
|
+
data.tar.gz: 921bf43b191ce9b0739a21e23edf6759dc1974380c39db1ba73e1ff47281703a45dcd168cf4ebfaf7ba4084d8778b139ef10ee4d39eef936d5b3807abef4d9f2
|
data/Gemfile.lock
CHANGED
data/lib/prompt_lists.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
2
|
require 'yaml'
|
4
3
|
|
5
4
|
module PromptLists
|
6
|
-
VERSION = '0.1.
|
5
|
+
VERSION = '0.1.1'
|
7
6
|
|
8
7
|
class List
|
9
8
|
attr_reader :id, :sublist_names
|
@@ -33,6 +32,7 @@ module PromptLists
|
|
33
32
|
class Sublist
|
34
33
|
attr_reader :id
|
35
34
|
attr_accessor :metadata, :items
|
35
|
+
|
36
36
|
def initialize(file_path)
|
37
37
|
@file_path = file_path
|
38
38
|
@id = File.basename(file_path, ".yml").gsub(/-/, "_").to_sym
|
@@ -49,14 +49,25 @@ module PromptLists
|
|
49
49
|
def all
|
50
50
|
Dir[File.expand_path("../lists/*", __dir__)].map do |list|
|
51
51
|
list_name = File.basename(list)
|
52
|
-
|
52
|
+
find(list_name)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
56
|
def find(list_name)
|
57
|
-
|
58
|
-
|
57
|
+
@lists ||= {}
|
58
|
+
|
59
|
+
if list_name.to_s.include?('.')
|
60
|
+
main_list, sublist = list_name.to_s.split('.')
|
61
|
+
if list_exists?(main_list)
|
62
|
+
list = find(main_list)
|
63
|
+
sublist_sym = sublist&.gsub(/-/, '_')&.to_sym
|
64
|
+
return list.send(sublist_sym) if list.sublist_names.include?(sublist_sym)
|
65
|
+
end
|
66
|
+
elsif list_exists?(list_name)
|
67
|
+
@lists[list_name.to_sym] ||= List.new(list_name, load_sublists(list_name))
|
68
|
+
return @lists[list_name.to_sym]
|
59
69
|
end
|
70
|
+
nil
|
60
71
|
end
|
61
72
|
|
62
73
|
def method_missing(method_name, *args)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prompt-lists
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dreaming Tulpa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|