Class: Protege::Generators::PersonaGenerator

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

Overview

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

The Persona suffix is applied for you, so all of support, Support, and SupportPersona produce class SupportPersona in support_persona.rb.

Examples:

bin/rails g protege:persona support

Instance Method Summary collapse

Instance Method Details

#create_personavoid

This method returns an undefined value.

Render the persona scaffold into config.personas_path.



29
30
31
32
# File 'lib/generators/protege/persona/persona_generator.rb', line 29

def create_persona
  template 'persona.rb.tt',
           File.join(Protege.configuration.personas_path, "#{extension_file_name('Persona')}.rb")
end