Module: CoffeeScript::MultiSource
- Defined in:
- lib/coffee_script.rb
Class Method Summary collapse
- .bare_option(version) ⇒ Object
- .contents_for(version) ⇒ Object
- .context_for(version) ⇒ Object
- .path_for(version) ⇒ Object
- .sources_directory ⇒ Object
Instance Method Summary collapse
Class Method Details
.bare_option(version) ⇒ Object
24 25 26 27 |
# File 'lib/coffee_script.rb', line 24 def self.(version) @base_option ||= {} @bare_option[version] ||= contents_for(version).match(/noWrap/) ? 'noWrap' : 'bare' end |
.contents_for(version) ⇒ Object
19 20 21 22 |
# File 'lib/coffee_script.rb', line 19 def self.contents_for(version) @contents ||= {} @contents[version] ||= File.read(path_for(version)) end |
.context_for(version) ⇒ Object
29 30 31 32 |
# File 'lib/coffee_script.rb', line 29 def self.context_for(version) @context ||= {} @context[version] ||= ExecJS.compile(contents_for(version)) end |
.path_for(version) ⇒ Object
14 15 16 17 |
# File 'lib/coffee_script.rb', line 14 def self.path_for(version) @path ||= {} @path[version] ||= File.join sources_directory, "coffee-script-#{version}.js" end |
.sources_directory ⇒ Object
34 35 36 |
# File 'lib/coffee_script.rb', line 34 def self.sources_directory File.("../../vendor", __FILE__) end |
Instance Method Details
#default_version ⇒ Object
10 11 12 |
# File 'lib/coffee_script.rb', line 10 def default_version ENV['COFFEESCRIPT_DEFAULT_VERSION'] || '1.4.0' end |