Class: Gherkin::JsLexer

Inherits:
Object
  • Object
show all
Defined in:
lib/gherkin/js_lexer.rb

Overview

Thin adapter for the JavaScript lexer, primarily used for testing.

Class Method Summary collapse

Class Method Details

.[](i18n_underscored_iso_code) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/gherkin/js_lexer.rb', line 6

def self.[](i18n_underscored_iso_code)
  cxt = V8::Context.new
  cxt['exports'] = {}

  # Mimic Node.js / Firebug console.log
  cxt['console'] = STDOUT
  def STDOUT.log(*a)
    p a
  end

  cxt.load(File.dirname(__FILE__) + "/../../js/lib/gherkin/lexer/#{i18n_underscored_iso_code}.min.js")
  cxt['exports']['Lexer']
end