Module: Eco::Source

Defined in:
lib/eco.rb

Class Method Summary collapse

Class Method Details

.combined_contentsObject



20
21
22
# File 'lib/eco.rb', line 20

def self.combined_contents
  [CoffeeScript::Source.contents, contents].join(";\n")
end

.contentsObject



16
17
18
# File 'lib/eco.rb', line 16

def self.contents
  @contents ||= File.read(path)
end

.contextObject



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

def self.context
  @context ||= ExecJS.compile(combined_contents)
end

.pathObject



7
8
9
# File 'lib/eco.rb', line 7

def self.path
  @path ||= ENV["ECO_SOURCE_PATH"] || bundled_path
end

.path=(path) ⇒ Object



11
12
13
14
# File 'lib/eco.rb', line 11

def self.path=(path)
  @contents = @version = @context = nil
  @path = path
end

.versionObject



24
25
26
# File 'lib/eco.rb', line 24

def self.version
  @version ||= contents[/Eco Compiler v(.*?)\s/, 1]
end