Class: ReactRuby::Renderer
- Inherits:
-
Object
- Object
- ReactRuby::Renderer
- Defined in:
- lib/react_ruby.rb
Instance Method Summary collapse
- #compile(config = {}) ⇒ Object
-
#initialize(config = {}) ⇒ Renderer
constructor
A new instance of Renderer.
- #render(jsx) ⇒ Object
Constructor Details
#initialize(config = {}) ⇒ Renderer
Returns a new instance of Renderer.
24 25 26 |
# File 'lib/react_ruby.rb', line 24 def initialize(config = {}) compile(config) end |
Instance Method Details
#compile(config = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/react_ruby.rb', line 28 def compile(config = {}) @config = ReactRuby.config.merge(config) jsx = @config[:jsx] jsx = JSX.transform(jsx) if jsx @context = ExecJS.compile(<<-JS) var global = global || this; #{@config[:react]} #{jsx} #{@config[:js]} JS end |