Module: Esnext::Source

Defined in:
lib/esnext.rb

Class Method Summary collapse

Class Method Details

.bundled_pathObject



18
19
20
# File 'lib/esnext.rb', line 18

def self.bundled_path
  File.expand_path('../../vendor/esnext.js', __FILE__)
end

.contentsObject



22
23
24
# File 'lib/esnext.rb', line 22

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

.contextObject



30
31
32
# File 'lib/esnext.rb', line 30

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

.pathObject



9
10
11
# File 'lib/esnext.rb', line 9

def self.path
  @path ||= ENV['ESNEXT_SOURCE_PATH'] || bundled_path
end

.path=(path) ⇒ Object



13
14
15
16
# File 'lib/esnext.rb', line 13

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

.versionObject



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

def self.version
  @version ||= contents[/esnext v([\d.]+)/, 1]
end