volt 0.7.12 → 0.7.13

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: 85bcb7f3f097162cab94d1d62b649fe2d37cea1a
4
- data.tar.gz: eec2788d9fa80fdbe0ee61386f40f8ce13f194af
3
+ metadata.gz: 6b0050f5ac129588d9ec24b02a9b8aaa19ff2003
4
+ data.tar.gz: 05b63b91265dc30256fa8db98114542aad699987
5
5
  SHA512:
6
- metadata.gz: bf2f03dc33ec3637a1d18b8a0a50a791fce3707b858ca7e9b78ded620dbf5e2931433648cf750313bb6c340fe79481830dbd28707083f4524e41702a2b72b2cb
7
- data.tar.gz: 24ebe1c03fb1f43bd1cb7d49e51593a8bd7a1165df62936310a3040903592c3d6ef17c84bca3639928e7dac97801e4e1a5c38028f4f9fdfb22347235f303c93b
6
+ metadata.gz: 354f2e09f8e0827a693171b73fbfcd08e66dece3725a788047d40e72a71890f046030e0bf8240f6270755c7f36b8e668fbf257d20346849feb93c19147b0923f
7
+ data.tar.gz: a33eb668641e8a7d2c6ab1176f025719486e4dc3fd9c1d4c26dcd4ff8e1c1e3e7c837178c7f1d2f8ccf651e84542102668d1e6b89f7be27d0615e07b9c3a7b7d
data/Readme.md CHANGED
@@ -14,7 +14,7 @@ Instead of syncing data between the client and server via HTTP, volt uses a pers
14
14
 
15
15
  Pages HTML is written in a handlebars like template language. Volt uses data flow/reactive programming to automatically and intelligently propagate changes to the DOM (or anything other code wanting to know when a value updates) When something in the DOM changes, Volt intelligently updates only the nodes that need to be changed.
16
16
 
17
- See a quick demo video here: [http://www.youtube.com/watch?v=j0vFIRMzarI](http://www.youtube.com/watch?v=j0vFIRMzarI)
17
+ See a quick demo video here: [https://www.youtube.com/watch?v=6ZIvs0oKnYs](https://www.youtube.com/watch?v=6ZIvs0oKnYs) and [https://www.youtube.com/watch?v=c478sMlhx1o](https://www.youtube.com/watch?v=c478sMlhx1o)
18
18
 
19
19
 
20
20
  ## Goals
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.12
1
+ 0.7.13
@@ -22,7 +22,7 @@ class LiveQueryPool < GenericPool
22
22
  private
23
23
  # Creates the live query if it doesn't exist, and stores it so it
24
24
  # can be found later.
25
- def create(collection, query)
25
+ def create(collection, query={})
26
26
  # If not already setup, create a new one for this collection/query
27
27
  return LiveQuery.new(self, @data_store, collection, query)
28
28
  end
Binary file
@@ -275,6 +275,8 @@ class Model
275
275
  # Add to the collection
276
276
  new_model = save_to.append(self.attributes)
277
277
 
278
+ # Set the buffer's id to track the main model's id
279
+ self.attributes[:_id] = new_model._id
278
280
  options[:save_to] = new_model
279
281
 
280
282
  # TODO: return a promise that resolves if the append works
@@ -53,14 +53,16 @@ module Persistors
53
53
 
54
54
  # Called when the model changes
55
55
  def changed(attribute_name=nil)
56
+ path = @model.path
57
+
56
58
  promise = Promise.new
57
59
 
58
60
  ensure_setup
59
61
 
60
- path_size = @model.path.size
62
+ path_size = path.size
61
63
  if !(defined?($loading_models) && $loading_models) && @tasks && path_size > 0 && !@model.nil?
62
64
  if path_size > 3 && (parent = @model.parent) && source = parent.parent
63
- @model.attributes[:"#{@model.path[-4].singularize}_id"] = source._id
65
+ @model.attributes[:"#{path[-4].singularize}_id"] = source._id
64
66
  end
65
67
 
66
68
  @tasks.call('StoreTasks', 'save', collection, self_attributes) do |errors|
@@ -47,7 +47,7 @@ class EventChain
47
47
  # Register an event listener that chains from object to self
48
48
  def setup_listener(event, chain_listener)
49
49
  return chain_listener.object.on(event, @main_object) do |filter, *args|
50
- if callback = chain_listener.callback
50
+ if (callback = chain_listener.callback)
51
51
  callback.call(event, filter, *args)
52
52
  else
53
53
  # Trigger on this value, when it happens on the parent
@@ -171,6 +171,7 @@ module Events
171
171
  end
172
172
 
173
173
  def trigger!(event, filter=nil, *args)
174
+ # puts "TRIGGER: #{event} on #{self.inspect}" if event == :added
174
175
  are_reactive = reactive?
175
176
 
176
177
  event = event.to_sym
@@ -236,7 +236,7 @@ class ReactiveArray# < Array
236
236
  end
237
237
 
238
238
  def inspect
239
- "#<#{self.class.to_s} #{@array.inspect}>"
239
+ "#<#{self.class.to_s}:#{object_id} #{@array.inspect}>"
240
240
  end
241
241
 
242
242
  # tag_method(:count) do
@@ -214,7 +214,7 @@ class ReactiveManager
214
214
  end
215
215
 
216
216
  def inspect
217
- "@<#{self.class.to_s}:#{reactive_object_id} #{cur.inspect}>"
217
+ "@<#{self.class.to_s}:#{object_id} #{cur.inspect}>"
218
218
  end
219
219
 
220
220
  def reactive_object_id
@@ -266,6 +266,7 @@ class ReactiveManager
266
266
 
267
267
 
268
268
  def update_followers
269
+ return if @setting_up
269
270
  if has_listeners?
270
271
  current_obj = cur(false, true)
271
272
  should_attach = current_obj.respond_to?(:on)
@@ -274,7 +275,9 @@ class ReactiveManager
274
275
  if !@cur_cache || current_obj.object_id != @cur_cache.object_id
275
276
  remove_followers
276
277
 
278
+ @setting_up = true
277
279
  @cur_cache_chain_listener = self.event_chain.add_object(current_obj)
280
+ @setting_up = nil
278
281
  end
279
282
  else
280
283
  remove_followers
@@ -283,6 +286,7 @@ class ReactiveManager
283
286
  # Store current if we have listeners
284
287
  @cur_cache = current_obj
285
288
  end
289
+
286
290
  end
287
291
 
288
292
  def remove_followers
@@ -59,7 +59,13 @@ class GenericPool
59
59
  alias_method :__lookup, :lookup
60
60
 
61
61
  def lookup_all(*args)
62
- __lookup(*args).values
62
+ result = __lookup(*args) { nil }
63
+
64
+ if result
65
+ return result.values
66
+ else
67
+ return []
68
+ end
63
69
  end
64
70
 
65
71
  def remove(*args)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: volt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.12
4
+ version: 0.7.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Stout
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-17 00:00:00.000000000 Z
11
+ date: 2014-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -352,6 +352,7 @@ files:
352
352
  - bin/volt
353
353
  - docs/GETTING_STARTED.md
354
354
  - docs/WHY.md
355
+ - docs/volt-logo.jpg
355
356
  - lib/volt.rb
356
357
  - lib/volt/assets/test.rb
357
358
  - lib/volt/benchmark/benchmark.rb