Class: Cog::GeneratorSandbox
- Inherits:
-
Object
- Object
- Cog::GeneratorSandbox
- Includes:
- Generator
- Defined in:
- lib/cog/generator_sandbox.rb
Overview
Generators files are executed as instances of this type. Plugins make themselves available to generators via a call to DSL::Cogfile#autoload_plugin
Class Method Summary collapse
-
.autoload_plugin(name, path) ⇒ nil
Register an autoload variable.
Instance Method Summary collapse
-
#initialize(path) ⇒ GeneratorSandbox
constructor
A new instance of GeneratorSandbox.
-
#interpret ⇒ nil
Interpret the generator ruby file as this instance.
Methods included from Generator
Methods included from Cog::Generator::LanguageMethods
#end_all_scopes, #include_guard_begin, #named_scope_begin, #scope_begin, #scope_end, #use_named_scope, #warning
Methods included from Cog::Generator::Filters
Methods included from Cog::Generator::FileMethods
#copy_file_if_missing, #files_are_same?, #get_template, #touch_directory, #touch_file
Constructor Details
#initialize(path) ⇒ GeneratorSandbox
Returns a new instance of GeneratorSandbox.
11 12 13 |
# File 'lib/cog/generator_sandbox.rb', line 11 def initialize(path) @path = path end |
Class Method Details
.autoload_plugin(name, path) ⇒ nil
Register an autoload variable.
26 27 28 29 |
# File 'lib/cog/generator_sandbox.rb', line 26 def self.autoload_plugin(name, path) autoload name, path nil end |
Instance Method Details
#interpret ⇒ nil
Interpret the generator ruby file as this instance
18 19 20 21 |
# File 'lib/cog/generator_sandbox.rb', line 18 def interpret eval File.read(@path), binding nil end |