breezy_template 0.3.0 → 0.4.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
  SHA1:
3
- metadata.gz: 5615a0d5186cccdec50df4bc728c6d472f877254
4
- data.tar.gz: ae3d4643bfa89ebbf2d38fd285b74ee909a73b06
3
+ metadata.gz: 389577cd7a952f1dc9c01fa549bd9fb4328dc7da
4
+ data.tar.gz: fc00b911792bcbba351e458a1cdb763cebc1c80d
5
5
  SHA512:
6
- metadata.gz: 4e639ce8e936ebb85324b90830425f005b3f17d7e1366ddb2f9d1d0a096cf4275e56b64ccc0c64aa32c66c365f94c6ca1c7e933a7ea71c50ef35101940f1d7d8
7
- data.tar.gz: 30b7c0e630b346d037447f26ca3a5265c8d0839c42c3218060fcbd37e2b5dd431819e7ab27136789b202dd8295794fb49d74d4f17c0c5178b74648867ce7805c
6
+ metadata.gz: f26770f783bed26af579db8b0bcdb2b87907a968d826e0bfd10705781f42b884a26d2fcf19eabc78bad4b2da21eb8661d766a2bbfd6ba81cdd9bcd0264d115e8
7
+ data.tar.gz: 88d00aa5d417488e872ea0b3a91d50c4dd7f1eb750616ae44333ea47a3fc2f17d53da5e7b0ecf4dfaf87ad5c866ead0be12dd7d93a101fc3cffa4c56aacdf362
@@ -13,6 +13,8 @@ if Rails.version >= '4.1'
13
13
  value
14
14
  elsif ::BreezyTemplate::DeferVar === value
15
15
  value
16
+ elsif ::BreezyTemplate::Undefined === value
17
+ value
16
18
  else
17
19
  original_jsonify(value)
18
20
  end
@@ -117,7 +117,7 @@ class BreezyTemplate
117
117
  def _cache_key(key, options={})
118
118
  key = _fragment_name_with_digest(key, options)
119
119
  key = url_for(key).split('://', 2).last if ::Hash === key
120
- key = ::ActiveSupport::Cache.expand_cache_key(key, :jbuilder)
120
+ key = ::ActiveSupport::Cache.expand_cache_key(key, :breezy)
121
121
 
122
122
  ::Digest::MD5.hexdigest(key.to_s).tap do |digest|
123
123
  _logger.try :debug, "Cache key :#{key} was digested to #{digest}"
@@ -1,6 +1,24 @@
1
1
  require 'breezy_template/breezy_template'
2
2
 
3
3
  class BreezyTemplate
4
+ class Undefined
5
+ def initialize
6
+ @value = "undefined"
7
+ end
8
+
9
+ def to_json(*)
10
+ @value
11
+ end
12
+
13
+ def as_json(*)
14
+ self
15
+ end
16
+
17
+ def encode_json(*)
18
+ @value
19
+ end
20
+ end
21
+
4
22
  module DefermentExtension
5
23
  ACTIVE_MODES = [:auto, :manual].freeze
6
24
 
@@ -10,7 +28,7 @@ class BreezyTemplate
10
28
  if _deferment_auto?(options)
11
29
  @js.push(_breezy_visit_current(@path))
12
30
  end
13
- return _set_value key, nil
31
+ return _set_value key, Undefined.new
14
32
  else
15
33
  super
16
34
  end
@@ -6,7 +6,7 @@ require 'mocha'
6
6
 
7
7
  class FakeTemplate
8
8
  attr_reader :source, :handler
9
- def initialize(source, handler = :jbuilder)
9
+ def initialize(source, handler = :breezy)
10
10
  @source, @handler = source, handler
11
11
  end
12
12
  end
@@ -1003,7 +1003,7 @@ class BreezyTemplateTest < ActionView::TestCase
1003
1003
  var cache={};
1004
1004
  var defers=[];
1005
1005
  cache["#{cache_keys[0]}"]={"greeting":"hello world"};
1006
- return ({"data":cache["219dfba9f552f91402a22cf67c633582"],"action":"graft","path":"hit.hit2","joints":joints,"defers":defers});
1006
+ return ({"data":cache["#{cache_keys[0]}"],"action":"graft","path":"hit.hit2","joints":joints,"defers":defers});
1007
1007
  })()
1008
1008
 
1009
1009
 
@@ -1156,7 +1156,7 @@ class BreezyTemplateTest < ActionView::TestCase
1156
1156
  var defers=[];
1157
1157
  defers.push({url:'/some_url?_breezy_filter=hit.hit2'});
1158
1158
  return (
1159
- {"data":{"hit":{"hit2":null}},"joints":joints,"defers":defers}
1159
+ {"data":{"hit":{"hit2":undefined}},"joints":joints,"defers":defers}
1160
1160
  );
1161
1161
  })()
1162
1162
  JS
@@ -1185,7 +1185,7 @@ class BreezyTemplateTest < ActionView::TestCase
1185
1185
  var cache={};
1186
1186
  var defers=[];
1187
1187
  return (
1188
- {"data":{"hit":{"hit2":null}},"joints":joints,"defers":defers}
1188
+ {"data":{"hit":{"hit2":undefined}},"joints":joints,"defers":defers}
1189
1189
  );
1190
1190
  })()
1191
1191
  JS
@@ -1219,7 +1219,7 @@ class BreezyTemplateTest < ActionView::TestCase
1219
1219
  defers.push({url:'/some_url?_breezy_filter=hit.hit2.id%3D1.greeting'});
1220
1220
  defers.push({url:'/some_url?_breezy_filter=hit.hit2.id%3D2.greeting'});
1221
1221
  return (
1222
- {"data":{"hit":{"hit2":[{"greeting":null},{"greeting":null}]}},"joints":joints,"defers":defers}
1222
+ {"data":{"hit":{"hit2":[{"greeting":undefined},{"greeting":undefined}]}},"joints":joints,"defers":defers}
1223
1223
  );
1224
1224
  })()
1225
1225
  JS
@@ -1283,7 +1283,7 @@ class BreezyTemplateTest < ActionView::TestCase
1283
1283
  var cache={};
1284
1284
  var defers=[];
1285
1285
  defers.push({url:'?_breezy_filter=hello.content'});
1286
- return ({"data":{"content":null},"action":"graft","path":"hello","joints":joints,"defers":defers});
1286
+ return ({"data":{"content":undefined},"action":"graft","path":"hello","joints":joints,"defers":defers});
1287
1287
  })()
1288
1288
  JS
1289
1289
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: breezy_template
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.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: 2017-12-20 00:00:00.000000000 Z
11
+ date: 2018-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack