class Ronin::Gen::SourceCodeGenerator

A {FileGenerator} class for creating source-code files.

Protected Class Methods

template(name=nil) click to toggle source

The template the Source Code Generator will use.

@param [String] name

The new template name.

@return [String]

The template the Source Code Generator will use.

@since 1.1.0

@api semipublic

# File lib/ronin/gen/source_code_generator.rb, line 66
def self.template(name=nil)
  if name
    @template = name
  else
    @template ||= if superclass < SourceCodeGenerator
                    superclass.template
                  end
  end
end

Public Instance Methods

generate() click to toggle source

Generates the source code file and spawns a text-editor.

@since 1.1.0

@api semipublic

# File lib/ronin/gen/source_code_generator.rb, line 42
def generate
  template self.class.template, @path

  if (edit? && editor?)
    # spawn the text editor for the newly generated file
    system(editor,@path)
  end
end