prompt_manager 0.3.0 → 0.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6785a25ba5b2c7e8bacf3bdba572eced1c95bdab2f83144a4ec32f0ae359eeb1
4
- data.tar.gz: fd21f559d660899ec94765b7ef3f3fd6a4579ac625a44af428ab7771ba934713
3
+ metadata.gz: add8f0261dd0fd2e91e8195330d923e8806c2e3a7243cfb51ce70a589fc76ef2
4
+ data.tar.gz: 73b69061afdd242679c231949fba6a3b075f486feb20113cb838d0345dd2ffcf
5
5
  SHA512:
6
- metadata.gz: 4373edc2de2e838a606ab748a81a73bc15242f9bac45343ce5d89fa2cd13fd57b228bf1f34e1a870e31640ff7f957382d44b65bcf0fa7360d004b95854965dae
7
- data.tar.gz: e1b04a1643de8de6a24618d5e2737241b17580922436bf6f3fa73e9caf394f9122426721eb3a44b37f227bd2eba21b0e20fad150a2b98265d707be033a7c4887
6
+ metadata.gz: a65630d9623b49c34265b137f03cfb032ec645f736e9ca9327e2aaf045cdd0e2818e28e1b000bc80b32016f32a59192861db6cc7596c8ea6834b2c386ce1aac2
7
+ data.tar.gz: ec16e90d781c354875932d454d04783bcd46b10f7a815ffe94204fd17475bc2930cb6627e55072ec9b937512031033bdf01eda83d62ed126d2833801fd156e0c
@@ -81,8 +81,9 @@ class PromptManager::Prompt
81
81
  # Return tje prompt text suitable for passing to a
82
82
  # gen-AI process.
83
83
  def to_s
84
- @prompt
84
+ build
85
85
  end
86
+ alias_method :prompt, :to_s
86
87
 
87
88
 
88
89
  # Save the prompt to the Storage system
@@ -108,20 +109,27 @@ class PromptManager::Prompt
108
109
  def build
109
110
  @prompt = text.gsub(PARAMETER_REGEX) do |match|
110
111
  param_name = match
111
- parameters[param_name].last || match
112
+ Array(parameters[param_name]).last || match
112
113
  end
113
114
 
114
115
  remove_comments
115
116
  end
116
117
 
118
+
119
+ def keywords
120
+ update_keywords
121
+ end
122
+
117
123
  ######################################
118
124
  private
119
125
 
120
126
  def update_keywords
121
127
  @keywords = @text.scan(PARAMETER_REGEX).flatten.uniq
122
- keywords.each do |kw|
128
+ @keywords.each do |kw|
123
129
  @parameters[kw] = [] unless @parameters.has_key?(kw)
124
130
  end
131
+
132
+ @keywords
125
133
  end
126
134
 
127
135
 
@@ -258,6 +258,7 @@ class PromptManager::Storage::FileSystemAdapter
258
258
  def write_with_error_handling(file_path, content)
259
259
  begin
260
260
  file_path.write content
261
+ true
261
262
  rescue IOError => e
262
263
  raise "Failed to write to file: #{e.message}"
263
264
  end
@@ -268,6 +269,7 @@ class PromptManager::Storage::FileSystemAdapter
268
269
  def delete_with_error_handling(file_path)
269
270
  begin
270
271
  file_path.delete
272
+ true
271
273
  rescue IOError => e
272
274
  raise "Failed to delete file: #{e.message}"
273
275
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PromptManager
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prompt_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dewayne VanHoozer