Class: Reco::Compiler
- Inherits:
-
Object
- Object
- Reco::Compiler
- Defined in:
- lib/reco/compiler.rb
Class Method Summary collapse
Class Method Details
.compile(source, options = {}) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/reco/compiler.rb', line 9 def self.compile(source, = {}) compiled_javascript = CoffeeScript.compile preprocess(source), :noWrap => true identifier = [:identifier] || 'module.exports' identifier = "var #{identifier}" unless identifier.include? '.' wrapper % [identifier, compiled_javascript] end |
.preprocess(source) ⇒ Object
5 6 7 |
# File 'lib/reco/compiler.rb', line 5 def self.preprocess(source) Preprocessor.preprocess source end |
.wrapper ⇒ Object
17 18 19 |
# File 'lib/reco/compiler.rb', line 17 def self.wrapper @wrapper ||= File.read File.join(File.dirname(__FILE__), 'wrapper.js') end |