Class: Protege::Generators::AgentGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
ExtensionNaming
Defined in:
lib/generators/protege/agent/agent_generator.rb

Overview

Scaffolds an agent — the identity Protege binds an inbox to — into the host app's agents directory (+config.agents_path+, default app/agents). An agent is an STI subclass of Protege::Agent (an ActiveRecord model); subclassing registers the subtype, and each agent declares its display name and the resolver chains that assemble context for its reply and scheduled runs.

The Agent suffix is applied for you, so all of support, Support, and SupportAgent produce class SupportAgent in support_agent.rb.

Examples:

bin/rails g protege:agent support

Instance Method Summary collapse

Instance Method Details

#create_agentvoid

This method returns an undefined value.

Render the agent scaffold into config.agents_path.



29
30
31
32
# File 'lib/generators/protege/agent/agent_generator.rb', line 29

def create_agent
  template 'agent.rb.tt',
           File.join(Protege.configuration.agents_path, "#{extension_file_name('Agent')}.rb")
end