render-react 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0601736fa6ccfc71f59c1b6b4917615d23ad10ce
4
- data.tar.gz: c424e643224f08d78117d85ba5b1f6a9b3b5cd8c
3
+ metadata.gz: 8ef894396e5e208e6ac5780d12e4b1da22411b4f
4
+ data.tar.gz: c3bfac33319a8c7f18db3e5323977e1bbdae075b
5
5
  SHA512:
6
- metadata.gz: f7fb9e86dd55826c6984beb8ee247450d6d4c8e50c03d732a589d3537f806bb2c4ac3eef0c3604e5613f2660f7c21308606edf2eaab88720ea5ea8235cf9f81c
7
- data.tar.gz: 7257db251438a7b46d1913dc145aa0aed6e1361fb5dd48cb0313a543ac4b9dfecbc092bf8732670f39c4978fb3d8b8508a3116cdc1b948895c808e95ab74a1e2
6
+ metadata.gz: 686d05b4d73a319ff2f3d46abc2e786317115a470109a068d7bf07f99729483f0e847a8b29f943f9bdbaa9525eefadfd8fd602a6c264f430e8a3754442736a5d
7
+ data.tar.gz: ed31c4f793fce79fd8ed50faf4518322d82c607a85b79b2d229dcee7ba3c77dae05d4bc4eec68f0aa5fa245b668cb7fe772fc15a42c46120aa4f4e922c36cb48
data/README.md CHANGED
@@ -11,19 +11,21 @@ It uses [V8 engine](https://developers.google.com/v8/) as dynamic library for Ja
11
11
  ## Installation
12
12
  Just add render-react to your Gemfile and you're done.
13
13
  ```bash
14
- echo 'gem render-react' >> Gemfile
14
+ echo "gem 'render-react'" >> Gemfile
15
15
  bundle install
16
16
  ```
17
17
 
18
18
  ## Usage (Rails)
19
- 1. Include Render::React into your ApplicationHelper
19
+ #### 1. Include Render::React into your ApplicationHelper
20
+
20
21
  ```ruby
21
22
  module ApplicationHelper
22
23
  include Render::React
23
24
  ...
24
25
  ```
25
26
 
26
- 2. Create initializer config/initializers/render_react.rb
27
+ #### 2. Create initializer config/initializers/render_react.rb
28
+
27
29
  ```ruby
28
30
  Render::React::Config.path File.join(Rails.root, 'app/assets/javascripts/components-local')
29
31
  Render::React::Config.path File.join(Rails.root, 'some/other/directory')
@@ -36,7 +38,8 @@ Render::React::Config.path(
36
38
  )
37
39
  ```
38
40
 
39
- 3. Render react component into your view (e.g. slim):
41
+ #### 3. Render react component into your view (e.g. slim)
42
+
40
43
  ```ruby
41
44
  == render_react 'Card', \
42
45
  className: 'city-block swiper-slide', \
@@ -7,7 +7,7 @@ module Render
7
7
 
8
8
  def create_context
9
9
  @cxt = Config.new_context
10
- @durability = Config::CONTEXT_DURABILITY
10
+ @durability = Config.durability
11
11
 
12
12
  js_lib_files = Dir.glob(
13
13
  File.join(
@@ -35,10 +35,13 @@ module Render
35
35
  def bootstrap
36
36
  if @durability
37
37
  if @durability <= 1
38
- @cxt.dispose
38
+ old_cxt = @cxt
39
+
39
40
  @cxt = nil
40
41
  create_context
41
42
  load_components
43
+
44
+ old_cxt.dispose
42
45
  else
43
46
  @durability -= 1
44
47
  end
@@ -1,7 +1,15 @@
1
1
  module Render
2
2
  module React
3
3
  module Config
4
- CONTEXT_DURABILITY = 100_000
4
+ @context_durability = 100_000
5
+
6
+ def set_durability(number)
7
+ @context_durability = number
8
+ end
9
+
10
+ def durability
11
+ @context_durability
12
+ end
5
13
 
6
14
  def path(*paths)
7
15
  @paths ||= []
@@ -22,7 +30,7 @@ module Render
22
30
  @gem_js_path ||= File.expand_path('../../../../js/dist', __FILE__)
23
31
  end
24
32
 
25
- module_function :path, :paths, :new_context, :gem_js_path
33
+ module_function :path, :paths, :new_context, :gem_js_path, :set_durability, :durability
26
34
  end
27
35
  end
28
36
  end
@@ -1,5 +1,5 @@
1
1
  module Render
2
2
  module React
3
- VERSION = '0.0.6'.freeze
3
+ VERSION = '0.0.7'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: render-react
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Krasnoschekov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-31 00:00:00.000000000 Z
11
+ date: 2016-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: therubyracer