jbuilder-jpartial 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99509e27d71e79724a98de5e985346e8bc9130b9
4
- data.tar.gz: a6661ff5c2e2c3ed5e8574bca33fe541dfa8e8ae
3
+ metadata.gz: b4f538f73814c66cb307f2c2cdba5b3962b64252
4
+ data.tar.gz: 36141cbfa5ca65b536ec50d7f8a191aa36731e63
5
5
  SHA512:
6
- metadata.gz: 2061f27c9d9572a1bb13a893b43f1293fe860d67ed6e13100a560e55429ced5804cd8aebc25dbef573aa051469cc678c1a80224385066d75ada7d30d54f6d9ba
7
- data.tar.gz: 79ee5ad363f610d87c11a1c2b29f3b210e3948d7d4d8f7722c2a7ae9660b458dacbb7a06637dc04fdaeeaf99c21c873fb46f976a67e0b43202b258408cc27387
6
+ metadata.gz: 34b6dc9be02b7839d03e88e6f64b188cf83681dff973d6a0fb2c6cfdc65c172704bf31bc8b17a690c5a5c7929b0c5f20dbf1a75f76e33e92c7f5019e3cdd77d3
7
+ data.tar.gz: 1159057018c7fd64b9ea7e58d462ecad2a610bdb9e8c3ccfd513c6cd528f03dcfce0fd7428bdcb1e56bc33ba90baf3a9ae07725762a86f0c3d6c353f2166393b
data/README.md CHANGED
@@ -74,7 +74,7 @@ When partials are used with `Jbuilder` render times and memory usage can skyrock
74
74
 
75
75
  Using a simple DSL, `Jbuilder::Jpartial` lets you define your partials in a familiar way while dramatically reducing overhead.
76
76
 
77
- The result is faster rendering and lower memory usage, while still being able to leverage the advantages of Jbuilder. In the above example, if we had used standard Jbuilder partials those templates would have to be rendered once for each `post` and/or `comment`. If you have 50 posts, each with 50 comments, that's 2,550 templates rendered! Using `Jbuilder::Jpartial`, the partial files are each only called when the partial is initialized. After that, all of the partial rendering is taken care of in the abstract from the original file. In our example, we hit `json.partial! 'post'` once and `json.partial! 'comments/comment' only once for each `post`, cutting 2,550 template renders down to 51.
77
+ The result is faster rendering and lower memory usage, while still being able to leverage the advantages of Jbuilder. In the above example, if we had used standard Jbuilder partials those templates would have to be rendered once for each `post` and/or `comment`. If you have 50 posts, each with 50 comments, that's 2,550 templates rendered! Using `Jbuilder::Jpartial`, the partial files are each only called when the partial is initialized. After that, all of the partial rendering is taken care of in the abstract from the original file. In our example, we hit `json.partial! 'post'` once and `json.partial! 'comments/comment'` only once for each `post`, cutting 2,550 template renders down to 51.
78
78
 
79
79
  Alternatively you can define all partials in one initializer file and call them wherever you need them: from within other partial definitions or anywhere you use `Jbuilder` in your views. The big advantage here is since they're initialized at start up, you don't need to call any additional view templates to render the partials. Using the same example as above:
80
80
 
@@ -123,7 +123,7 @@ Now in your `.jbuilder` templates you can call `json._post @post`.
123
123
 
124
124
  You can specify multiple arguments and even use keyword options if you need to pass more than one local variable to the partial. You can also call partial methods from within other partial methods.
125
125
 
126
- The rule of thumb when defining your partials in views is you need to make sure the partial is initialized by making a call to the template, outside of your render logic and/or any loops/iteration.
126
+ The rule of thumb when defining your partials in view templates is you need to make sure the partial is initialized by making a call to the template, outside of your render logic and/or any loops/iteration.
127
127
 
128
128
  e.g.
129
129
 
@@ -162,7 +162,7 @@ end
162
162
 
163
163
  However unlikely, if you try to name a partial with the same name as a method already defined by Jbuilder it will throw an error at start up. Just pick a different name, like `#whatever_partial` instead of `#whatever`.
164
164
 
165
- Methods taken by this library are `Jbuilder#json` and any route helpers e.g. `Jbuilder#post_url`. If you have or need any fields with keys like `"json"` or `"post_url"` use `Jbuilder#set!`, e.g.
165
+ Methods taken by this library are `Jbuilder#json` and any valid route helpers defined by your app e.g. `Jbuilder#post_url`. If you have or need any fields with keys like `"json"` or `"post_url"` use `Jbuilder#set!`, e.g.
166
166
  ```ruby
167
167
  json.set! 'json', 'some value'
168
168
  json.set! 'post_url', 'some url'
@@ -1,4 +1,5 @@
1
1
  require 'jbuilder'
2
+ require 'jbuilder/jpartial/version'
2
3
 
3
4
  # Top level Jbuilder class
4
5
  class Jbuilder
@@ -1,5 +1,11 @@
1
+ begin
2
+ require 'jbuilder/jbuilder'
3
+ rescue LoadError => e
4
+ puts e.message
5
+ end
6
+
1
7
  class Jbuilder
2
8
  module Jpartial
3
- VERSION = '1.0.0'.freeze
9
+ VERSION = '1.0.1'.freeze
4
10
  end
5
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jbuilder-jpartial
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - M. Simon Borg