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.
20 21 22 23 24 25 |
# File 'lib/roast/helpers/prompt_loader.rb', line 20 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
15 16 17 |
# File 'lib/roast/helpers/prompt_loader.rb', line 15 def load_prompt(context, target_file) new(context, target_file).load end |
Instance Method Details
#load ⇒ Object
27 28 29 30 31 32 |
# File 'lib/roast/helpers/prompt_loader.rb', line 27 def load prompt_content = read_prompt_file(find_prompt_path) return unless prompt_content process_erb_if_needed(prompt_content) end |