Class: Terraspace::Compiler::Strategy::Mod

Inherits:
AbstractBase show all
Defined in:
lib/terraspace/compiler/strategy/mod.rb,
lib/terraspace/compiler/strategy/mod/rb.rb,
lib/terraspace/compiler/strategy/mod/tf.rb,
lib/terraspace/compiler/strategy/mod/base.rb,
lib/terraspace/compiler/strategy/mod/pass.rb

Defined Under Namespace

Classes: Base, Pass, Rb, Tf

Instance Method Summary collapse

Methods inherited from AbstractBase

#initialize

Constructor Details

This class inherits a constructor from Terraspace::Compiler::Strategy::AbstractBase

Instance Method Details

#runObject



3
4
5
6
7
8
# File 'lib/terraspace/compiler/strategy/mod.rb', line 3

def run
  ext = File.extname(@src_path).sub('.','')
  klass = strategy_class(ext)
  strategy = klass.new(@mod, @src_path) # IE: Terraspace::Compiler::Strategy::Mod::Rb.new
  strategy.run
end

#strategy_class(ext) ⇒ Object



10
11
12
13
# File 'lib/terraspace/compiler/strategy/mod.rb', line 10

def strategy_class(ext)
  return Mod::Pass if ext.empty? # infinite loop without this
  "Terraspace::Compiler::Strategy::Mod::#{ext.camelize}".constantize rescue Mod::Pass
end