Class: UpAndRunning::Compiler

Inherits:
Object
  • Object
show all
Defined in:
lib/up_and_running/compiler.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, out) ⇒ Compiler

Returns a new instance of Compiler.

Parameters:

  • scope
    • evaluation context for ERB templates

  • out
    • directory to output the compiled templates



18
19
20
21
# File 'lib/up_and_running/compiler.rb', line 18

def initialize(scope, out)
  @scope = scope
  @out = out
end

Class Method Details

.inherited(subclass) ⇒ Object



6
7
8
9
# File 'lib/up_and_running/compiler.rb', line 6

def inherited(subclass)
  @path_of ||= {}
  @path_of[subclass] = caller.first.sub(/:.*/, '')
end

.path_of(klass) ⇒ Object



11
12
13
# File 'lib/up_and_running/compiler.rb', line 11

def path_of(klass)
  @path_of[klass]
end

Instance Method Details

#after_compileObject



30
# File 'lib/up_and_running/compiler.rb', line 30

def after_compile; end

#before_compileObject



23
# File 'lib/up_and_running/compiler.rb', line 23

def before_compile; end

#compileObject



25
26
27
28
# File 'lib/up_and_running/compiler.rb', line 25

def compile
  copy_dir if dir
  compile_erb(@scope) if compile_erb?
end