Class: Roast::Helpers::PromptLoader
- Inherits:
-
Object
- Object
- Roast::Helpers::PromptLoader
- Defined in:
- lib/roast/helpers/prompt_loader.rb
Class Method Summary collapse
-
.load_prompt(context, target_file) ⇒ String?
Loads a sidecar prompt file for a given context (workflow or step) and target file.
Instance Method Summary collapse
-
#initialize(context, target_file) ⇒ PromptLoader
constructor
A new instance of PromptLoader.
- #load ⇒ Object
Constructor Details
#initialize(context, target_file) ⇒ PromptLoader
Returns a new instance of PromptLoader.
17 18 19 20 21 22 |
# File 'lib/roast/helpers/prompt_loader.rb', line 17 def initialize(context, target_file) @context = context @name = context.name @context_path = context.context_path @target_file = target_file end |
Class Method Details
.load_prompt(context, target_file) ⇒ String?
Loads a sidecar prompt file for a given context (workflow or step) and target file
12 13 14 |
# File 'lib/roast/helpers/prompt_loader.rb', line 12 def load_prompt(context, target_file) new(context, target_file).load end |
Instance Method Details
#load ⇒ Object
24 25 26 27 28 29 |
# File 'lib/roast/helpers/prompt_loader.rb', line 24 def load prompt_content = read_prompt_file(find_prompt_path) return unless prompt_content process_erb_if_needed(prompt_content) end |