Module: React::JSX
- Defined in:
- lib/react/jsx.rb,
lib/react/jsx/template.rb
Defined Under Namespace
Classes: Template
Class Method Summary collapse
Class Method Details
.context ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/react/jsx.rb', line 7 def self.context # TODO: create React::Source::contents_for contents = # If execjs uses therubyracer, there is no 'global'. Make sure # we have it so JSX script can work properly. 'var global = global || this;' + File.read(React::Source.bundled_path_for('JSXTransformer.js')) @context ||= ExecJS.compile(contents) end |
.transform(code) ⇒ Object
17 18 19 20 |
# File 'lib/react/jsx.rb', line 17 def self.transform(code) result = context.call('JSXTransformer.transform', code) return result['code'] end |