Class: XAeonAgents::GenHelpers::ErbEvaluator

Inherits:
Object
  • Object
show all
Includes:
XAeonAgents::GenHelpers
Defined in:
lib/x_aeon_agents/gen_helpers.rb

Overview

Small class that can serve as a container for ERB evaluation with our DSL

Public API collapse

Methods included from XAeonAgents::GenHelpers

#announce, config, #goal, #goal_sentence, #name, #ordered_todo_list, #rule, #skill, #tmp_path, #when_to_use

Constructor Details

#initialize(erb_file) ⇒ ErbEvaluator

Constructor

Parameters:

  • erb_file (String)

    File containing the ERB template



189
190
191
192
193
# File 'lib/x_aeon_agents/gen_helpers.rb', line 189

def initialize(erb_file)
  @erb = ERB.new(File.read(erb_file), trim_mode: '-')
  # Use filename for better error reporting
  @erb.filename = erb_file
end

Instance Method Details

#resultString

Evaluate the ERB template

Returns:

  • (String)

    The evaluated ERB result



198
199
200
# File 'lib/x_aeon_agents/gen_helpers.rb', line 198

def result
  @erb.result(binding)
end