props_template 0.24.0 → 0.30.0

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
  SHA256:
3
- metadata.gz: ed3fa0a5fda4993c730d2391de3e2a1d7f05e43580dc5e429734b5f8e7b07391
4
- data.tar.gz: 005ed8fa15532e3e80530fae2a4c1bbd0002d9b9dcf5e2a41c64d34c62df2db0
3
+ metadata.gz: 4f39427b50eb55be6d32d7e4b2217653cf316161c47cbc8e983cb5db9d2884ef
4
+ data.tar.gz: 951b23bdd0db81fcd1703d772d471065b79e56ebfb2f4620d68cf35ccd54dfa8
5
5
  SHA512:
6
- metadata.gz: 2a65e69050103126e02af67ebbf44af9817edd221467fef1ae6f9c715964b8c212ecc9d3a8796e9ec0868e395911668f11176dae3ce5c722620f9eccb326cede
7
- data.tar.gz: b59b42c55eee9fb209093c38aeab2d369da005a6be41feecd73ecef62f6323b61ac41e879e005b40b584817d80e2b8873fb37c2c62dc22015177053371b5c08f
6
+ metadata.gz: 4b6132b57aae55b5fdaf3b4c8cb64bf80f6b867ab07dda003eca4a20a487fd10a6879e9877486d2fa1c3781ba4c4e38f85ee83406a668cf54b2ebe4335415ce6
7
+ data.tar.gz: cf2ebd26707c62748c40e646d855251028b8d27e0b3b26ecd1b15ad704ed37740065e3ddbbebeab1f0be0e99ab8b733932e120c521f5eb363fd6dc25be5a5c28
data/README.md CHANGED
@@ -31,7 +31,7 @@ json.flash flash.to_h
31
31
  json.menu do
32
32
  # By default, all keys will be formatted as camelCase. See #change_key_format
33
33
 
34
- json.current_user do
34
+ json.currentUser do
35
35
  json.email current_user.email
36
36
  json.avatar current_user.avatar
37
37
  json.inbox current_user.messages.count
@@ -40,7 +40,7 @@ end
40
40
 
41
41
  json.dashboard(defer: :auto) do
42
42
  sleep 5
43
- json.complex_post_metric 500
43
+ json.complexPostMetric 500
44
44
  end
45
45
 
46
46
  json.posts do
@@ -51,13 +51,13 @@ json.posts do
51
51
  json.array! paged_posts, key: :id do |post|
52
52
  json.id post.id
53
53
  json.description post.description
54
- json.comments_count post.comments.count
55
- json.edit_path edit_post_path(post)
54
+ json.commentsCount post.comments.count
55
+ json.editPath edit_post_path(post)
56
56
  end
57
57
  end
58
58
 
59
- json.pagination_path posts_path
60
- json.current paged_posts.current_page
59
+ json.paginationPath posts_path
60
+ json.current pagedPosts.current_page
61
61
  json.total @posts.count
62
62
  end
63
63
 
@@ -98,14 +98,14 @@ Defines the attribute or structure. All keys are automatically camelized lower
98
98
  by default. See [Change Key Format](#change-key-format) to change this behavior.
99
99
 
100
100
  ```ruby
101
- json.set! :author_details, {...options} do
102
- json.set! :first_name, 'David'
101
+ json.set! :authorDetails, {...options} do
102
+ json.set! :firstName, 'David'
103
103
  end
104
104
 
105
105
  or
106
106
 
107
- json.author_details, {...options} do
108
- json.first_name 'David'
107
+ json.authorDetails, {...options} do
108
+ json.firstName 'David'
109
109
  end
110
110
 
111
111
 
@@ -121,11 +121,11 @@ The inline form defines key and value
121
121
 
122
122
  ```ruby
123
123
 
124
- json.set! :first_name, 'David'
124
+ json.set! :firstName, 'David'
125
125
 
126
126
  or
127
127
 
128
- json.first_name 'David'
128
+ json.firstName 'David'
129
129
 
130
130
  # => { "firstName": "David" }
131
131
  ```
@@ -165,7 +165,7 @@ collection = [ {name: 'john'}, {name: 'jim'} ]
165
165
 
166
166
  json.details do
167
167
  json.array! collection, {...options} do |person|
168
- json.first_name person[:name]
168
+ json.firstName person[:name]
169
169
  end
170
170
  end
171
171
 
@@ -348,7 +348,7 @@ Usage:
348
348
 
349
349
  ```ruby
350
350
  json.author(cache: "some_cache_key") do
351
- json.first_name "tommy"
351
+ json.firstName "tommy"
352
352
  end
353
353
 
354
354
  #or
@@ -404,7 +404,7 @@ Usage:
404
404
  ```ruby
405
405
  json.dashboard(defer: :manual) do
406
406
  sleep 10
407
- json.some_fancy_metric 42
407
+ json.someFancyMetric 42
408
408
  end
409
409
 
410
410
 
@@ -412,7 +412,7 @@ end
412
412
 
413
413
  json.dashboard(defer: [:manual, placeholder: {}]) do
414
414
  sleep 10
415
- json.some_fancy_metric 42
415
+ json.someFancyMetric 42
416
416
  end
417
417
  ```
418
418
 
@@ -423,7 +423,7 @@ A auto option is available:
423
423
  ```ruby
424
424
  json.dashboard(defer: :auto) do
425
425
  sleep 10
426
- json.some_fancy_metric 42
426
+ json.someFancyMetric 42
427
427
  end
428
428
  ```
429
429
 
@@ -490,7 +490,7 @@ json.data(search: traversal_path) do
490
490
 
491
491
  json.personal do
492
492
  json.name 'james'
493
- json.zip_code 91210
493
+ json.zipCode 91210
494
494
  end
495
495
  end
496
496
  end
@@ -586,8 +586,8 @@ json.flash flash.to_h
586
586
  will render Layout first, then the template when `yield json` is used.
587
587
 
588
588
  ## Change key format
589
- By default, all keys will be formatted with `camelized(:lower)`. If you want to
590
- change this behavior, override it in an initializer:
589
+ By default, keys are not formatted. If you want to change this behavior,
590
+ override it in an initializer:
591
591
 
592
592
  ```ruby
593
593
  Props::BaseWithExtensions.class_eval do
@@ -115,7 +115,6 @@ module Props
115
115
  @stream.reset
116
116
 
117
117
  @scope = nil
118
- @key_cache = {}
119
118
  json
120
119
  end
121
120
  end
@@ -5,10 +5,8 @@ module Props
5
5
  def initialize(builder, context = nil, options = {})
6
6
  @context = context
7
7
  @builder = builder
8
- # todo: refactor so deferred can be its own class
9
8
  @em = ExtensionManager.new(self)
10
9
  @traveled_path = []
11
- @key_cache = {}
12
10
  super()
13
11
  end
14
12
 
@@ -45,8 +43,7 @@ module Props
45
43
  end
46
44
 
47
45
  def format_key(key)
48
- @key_cache[key] ||= key.to_s.camelize(:lower)
49
- @key_cache[key].dup
46
+ key.to_s
50
47
  end
51
48
 
52
49
  def set!(key, options = {}, &block)
@@ -1,3 +1,3 @@
1
1
  module Props
2
- VERSION = "0.24.0".freeze
2
+ VERSION = "0.30.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: props_template
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.0
4
+ version: 0.30.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johny Ho
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-04 00:00:00.000000000 Z
11
+ date: 2023-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport