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



23
24
25
# File 'lib/dependence/compiler.rb', line 23

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

.get_compiler_for(extension) ⇒ Object



12
13
14
15
16
17
# File 'lib/dependence/compiler.rb', line 12

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

.inherited(compiler) ⇒ Object



8
9
10
# File 'lib/dependence/compiler.rb', line 8

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

.supported_extensionsObject



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

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

Instance Method Details

#compileObject



28
29
30
# File 'lib/dependence/compiler.rb', line 28

def compile
  raise "abstract method"
end