Class: Dependence::Compiler

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

Direct Known Subclasses

CoffeeScriptCompiler, JavaScriptCompiler

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.compile(*args) ⇒ Object



21
22
23
# File 'lib/dependence/compiler.rb', line 21

def compile(*args)
  self.new.compile(*args)
end

.get_compiler_for(extension) ⇒ Object



10
11
12
13
14
15
# File 'lib/dependence/compiler.rb', line 10

def get_compiler_for(extension)
  extension.gsub!(/^\./, "")
  @@compilers.find do |compiler|
    compiler.extensions.include?(extension.to_sym)
  end
end

.inherited(compiler) ⇒ Object



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

def inherited(compiler)
  @@compilers << compiler
end

.supported_extensionsObject



17
18
19
# File 'lib/dependence/compiler.rb', line 17

def supported_extensions
  @@compilers.map { |c| c.extensions }.flatten.map {|e| ".#{e.to_s}" }
end

Instance Method Details

#compileObject



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

def compile
  raise "abstract method"
end