volt 0.8.15 → 0.8.16

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.
Files changed (162) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +11 -0
  3. data/CHANGELOG.md +11 -0
  4. data/Gemfile +1 -1
  5. data/Guardfile +2 -3
  6. data/Rakefile +1 -4
  7. data/VERSION +1 -1
  8. data/app/volt/controllers/notices_controller.rb +1 -1
  9. data/app/volt/tasks/live_query/data_store.rb +7 -7
  10. data/app/volt/tasks/live_query/live_query.rb +7 -9
  11. data/app/volt/tasks/live_query/live_query_pool.rb +13 -12
  12. data/app/volt/tasks/live_query/query_tracker.rb +4 -5
  13. data/app/volt/tasks/query_tasks.rb +9 -11
  14. data/app/volt/tasks/store_tasks.rb +4 -4
  15. data/app/volt/tasks/user_tasks.rb +1 -1
  16. data/bin/volt +2 -2
  17. data/lib/volt.rb +3 -7
  18. data/lib/volt/assets/test.rb +1 -2
  19. data/lib/volt/benchmark/benchmark.rb +3 -3
  20. data/lib/volt/boot.rb +1 -1
  21. data/lib/volt/cli.rb +18 -18
  22. data/lib/volt/cli/asset_compile.rb +8 -10
  23. data/lib/volt/cli/generate.rb +9 -11
  24. data/lib/volt/cli/new_gem.rb +51 -51
  25. data/lib/volt/config.rb +2 -3
  26. data/lib/volt/console.rb +1 -1
  27. data/lib/volt/controllers/model_controller.rb +6 -6
  28. data/lib/volt/data_stores/data_store.rb +1 -1
  29. data/lib/volt/data_stores/mongo_driver.rb +1 -1
  30. data/lib/volt/extra_core/array.rb +2 -2
  31. data/lib/volt/extra_core/blank.rb +1 -2
  32. data/lib/volt/extra_core/extra_core.rb +1 -1
  33. data/lib/volt/extra_core/inflector/methods.rb +0 -1
  34. data/lib/volt/extra_core/logger.rb +13 -7
  35. data/lib/volt/extra_core/numeric.rb +1 -1
  36. data/lib/volt/extra_core/string.rb +7 -7
  37. data/lib/volt/extra_core/stringify_keys.rb +5 -5
  38. data/lib/volt/models.rb +2 -2
  39. data/lib/volt/models/array_model.rb +18 -19
  40. data/lib/volt/models/cursor.rb +0 -1
  41. data/lib/volt/models/model.rb +17 -35
  42. data/lib/volt/models/model_hash_behaviour.rb +0 -2
  43. data/lib/volt/models/model_state.rb +1 -1
  44. data/lib/volt/models/model_wrapper.rb +1 -1
  45. data/lib/volt/models/persistors/array_store.rb +26 -13
  46. data/lib/volt/models/persistors/base.rb +1 -1
  47. data/lib/volt/models/persistors/flash.rb +2 -2
  48. data/lib/volt/models/persistors/local_store.rb +2 -3
  49. data/lib/volt/models/persistors/model_store.rb +7 -6
  50. data/lib/volt/models/persistors/params.rb +2 -2
  51. data/lib/volt/models/persistors/query/query_listener.rb +2 -0
  52. data/lib/volt/models/persistors/query/query_listener_pool.rb +1 -1
  53. data/lib/volt/models/persistors/store.rb +1 -2
  54. data/lib/volt/models/persistors/store_state.rb +2 -3
  55. data/lib/volt/models/url.rb +17 -16
  56. data/lib/volt/models/validations.rb +11 -14
  57. data/lib/volt/models/validators/length_validator.rb +3 -3
  58. data/lib/volt/models/validators/presence_validator.rb +2 -2
  59. data/lib/volt/page/bindings/attribute_binding.rb +2 -3
  60. data/lib/volt/page/bindings/base_binding.rb +1 -1
  61. data/lib/volt/page/bindings/each_binding.rb +8 -9
  62. data/lib/volt/page/bindings/event_binding.rb +2 -3
  63. data/lib/volt/page/bindings/template_binding.rb +8 -7
  64. data/lib/volt/page/bindings/template_binding/grouped_controllers.rb +2 -1
  65. data/lib/volt/page/channel.rb +10 -10
  66. data/lib/volt/page/channel_stub.rb +1 -1
  67. data/lib/volt/page/document.rb +0 -1
  68. data/lib/volt/page/document_events.rb +4 -4
  69. data/lib/volt/page/page.rb +26 -19
  70. data/lib/volt/page/string_template_renderer.rb +2 -2
  71. data/lib/volt/page/sub_context.rb +10 -4
  72. data/lib/volt/page/targets/attribute_section.rb +1 -1
  73. data/lib/volt/page/targets/attribute_target.rb +1 -2
  74. data/lib/volt/page/targets/base_section.rb +4 -4
  75. data/lib/volt/page/targets/binding_document/base_node.rb +0 -1
  76. data/lib/volt/page/targets/binding_document/component_node.rb +4 -5
  77. data/lib/volt/page/targets/dom_section.rb +21 -22
  78. data/lib/volt/page/targets/dom_target.rb +1 -1
  79. data/lib/volt/page/targets/dom_template.rb +11 -12
  80. data/lib/volt/page/targets/helpers/comment_searchers.rb +7 -8
  81. data/lib/volt/page/tasks.rb +0 -1
  82. data/lib/volt/page/template_renderer.rb +1 -1
  83. data/lib/volt/page/url_tracker.rb +3 -3
  84. data/lib/volt/reactive/computation.rb +5 -11
  85. data/lib/volt/reactive/dependency.rb +1 -3
  86. data/lib/volt/reactive/eventable.rb +17 -4
  87. data/lib/volt/reactive/hash_dependency.rb +1 -0
  88. data/lib/volt/reactive/reactive_accessors.rb +0 -1
  89. data/lib/volt/reactive/reactive_array.rb +20 -25
  90. data/lib/volt/reactive/reactive_hash.rb +3 -3
  91. data/lib/volt/router/routes.rb +11 -13
  92. data/lib/volt/server.rb +17 -17
  93. data/lib/volt/server/component_handler.rb +2 -2
  94. data/lib/volt/server/component_templates.rb +8 -8
  95. data/lib/volt/server/html_parser/attribute_scope.rb +9 -10
  96. data/lib/volt/server/html_parser/if_view_scope.rb +2 -2
  97. data/lib/volt/server/html_parser/sandlebars_parser.rb +14 -14
  98. data/lib/volt/server/html_parser/textarea_scope.rb +1 -2
  99. data/lib/volt/server/html_parser/view_handler.rb +1 -1
  100. data/lib/volt/server/html_parser/view_parser.rb +1 -1
  101. data/lib/volt/server/html_parser/view_scope.rb +10 -10
  102. data/lib/volt/server/rack/asset_files.rb +15 -16
  103. data/lib/volt/server/rack/component_code.rb +2 -2
  104. data/lib/volt/server/rack/component_html_renderer.rb +0 -1
  105. data/lib/volt/server/rack/component_paths.rb +13 -10
  106. data/lib/volt/server/rack/index_files.rb +4 -4
  107. data/lib/volt/server/rack/opal_files.rb +4 -5
  108. data/lib/volt/server/rack/source_map_server.rb +3 -3
  109. data/lib/volt/server/socket_connection_handler.rb +3 -4
  110. data/lib/volt/server/socket_connection_handler_stub.rb +1 -1
  111. data/lib/volt/spec/setup.rb +3 -3
  112. data/lib/volt/store/mongo.rb +2 -2
  113. data/lib/volt/tasks/task_handler.rb +3 -3
  114. data/lib/volt/utils/generic_counting_pool.rb +2 -2
  115. data/lib/volt/utils/generic_pool.rb +7 -8
  116. data/lib/volt/utils/local_storage.rb +4 -4
  117. data/lib/volt/volt/environment.rb +1 -1
  118. data/spec/apps/file_loading/app/shared/config/dependencies.rb +1 -1
  119. data/spec/apps/kitchen_sink/Gemfile +0 -2
  120. data/spec/apps/kitchen_sink/app/main/config/routes.rb +5 -5
  121. data/spec/apps/kitchen_sink/app/main/controllers/main_controller.rb +7 -6
  122. data/spec/apps/kitchen_sink/app/main/controllers/todos_controller.rb +3 -4
  123. data/spec/controllers/reactive_accessors_spec.rb +4 -4
  124. data/spec/extra_core/inflector_spec.rb +1 -1
  125. data/spec/extra_core/string_transformation_test_cases.rb +23 -24
  126. data/spec/extra_core/string_transformations_spec.rb +11 -12
  127. data/spec/integration/bindings_spec.rb +15 -15
  128. data/spec/integration/list_spec.rb +12 -13
  129. data/spec/integration/templates_spec.rb +3 -3
  130. data/spec/models/model_spec.rb +74 -80
  131. data/spec/models/persistors/params_spec.rb +2 -2
  132. data/spec/models/persistors/store_spec.rb +4 -4
  133. data/spec/models/validations_spec.rb +14 -23
  134. data/spec/page/bindings/content_binding_spec.rb +7 -8
  135. data/spec/page/bindings/template_binding_spec.rb +22 -24
  136. data/spec/page/sub_context_spec.rb +2 -2
  137. data/spec/reactive/computation_spec.rb +3 -3
  138. data/spec/reactive/reactive_array_spec.rb +12 -12
  139. data/spec/router/routes_spec.rb +45 -48
  140. data/spec/server/html_parser/sandlebars_parser_spec.rb +42 -42
  141. data/spec/server/html_parser/view_parser_spec.rb +132 -153
  142. data/spec/server/rack/asset_files_spec.rb +9 -8
  143. data/spec/server/rack/component_paths_spec.rb +5 -5
  144. data/spec/server/rack/rack_requests_spec.rb +3 -3
  145. data/spec/spec_helper.rb +1 -1
  146. data/spec/tasks/live_query_spec.rb +4 -5
  147. data/spec/tasks/query_tasks.rb +2 -4
  148. data/spec/tasks/query_tracker_spec.rb +29 -29
  149. data/spec/templates/targets/binding_document/component_node_spec.rb +1 -1
  150. data/spec/utils/generic_counting_pool_spec.rb +4 -4
  151. data/spec/utils/generic_pool_spec.rb +12 -12
  152. data/templates/component/config/routes.rb +2 -2
  153. data/templates/component/controllers/main_controller.rb +7 -6
  154. data/templates/newgem/app/newgem/config/dependencies.rb +1 -1
  155. data/templates/newgem/app/newgem/config/routes.rb +1 -1
  156. data/templates/project/app/main/config/routes.rb +2 -2
  157. data/templates/project/app/main/controllers/main_controller.rb +7 -6
  158. data/templates/project/spec/sample_spec.rb +2 -2
  159. data/volt.gemspec +32 -33
  160. metadata +3 -4
  161. data/lib/volt/extra_core/log.rb +0 -56
  162. data/lib/volt/extra_core/try.rb +0 -31
@@ -7,7 +7,7 @@ module Volt
7
7
  # may be allowed in the future (iframes?)
8
8
  class DomTarget < BaseSection
9
9
  def dom_section(*args)
10
- return DomSection.new(*args)
10
+ DomSection.new(*args)
11
11
  end
12
12
  end
13
13
  end
@@ -1,11 +1,11 @@
1
1
  require 'volt/page/targets/helpers/comment_searchers'
2
2
 
3
3
  module Volt
4
- # A dom template is used to optimize going from a template name to
5
- # dom nodes and bindings. It stores a copy of the template's parsed
6
- # dom nodes, then when a new instance is requested, it updates the
7
- # dom markers (comments) for new binding numbers and returns a cloneNode'd
8
- # version of the dom nodes and the bindings.
4
+ # A dom template is used to optimize going from a template name to
5
+ # dom nodes and bindings. It stores a copy of the template's parsed
6
+ # dom nodes, then when a new instance is requested, it updates the
7
+ # dom markers (comments) for new binding numbers and returns a cloneNode'd
8
+ # version of the dom nodes and the bindings.
9
9
  class DomTemplate
10
10
  include CommentSearchers
11
11
 
@@ -31,10 +31,9 @@ module Volt
31
31
 
32
32
  new_nodes = `self.nodes.cloneNode(true)`
33
33
 
34
- return [new_nodes, bindings]
34
+ [new_nodes, bindings]
35
35
  end
36
36
 
37
-
38
37
  # Finds each of the binding anchors in the temp dom, then stores a reference
39
38
  # to them so they can be quickly updated without using xpath to find them again.
40
39
  def track_binding_anchors
@@ -45,9 +44,9 @@ module Volt
45
44
  if name.is_a?(String)
46
45
  # Find the dom node for an attribute anchor
47
46
  node = nil
48
- %x{
47
+ `
49
48
  node = self.nodes.querySelector('#' + name);
50
- }
49
+ `
51
50
  @binding_anchors[name] = node
52
51
  else
53
52
  # Find the dom node for a comment anchor
@@ -86,7 +85,7 @@ module Volt
86
85
  else
87
86
  start_comment, end_comment = anchors
88
87
 
89
- %x{
88
+ `
90
89
  if (start_comment.textContent) {
91
90
  // direct update
92
91
  start_comment.textContent = " $" + new_name + " ";
@@ -100,7 +99,7 @@ module Volt
100
99
  start_comment.nodeValue = " $" + new_name + " ";
101
100
  end_comment.nodeValue = " $/" + new_name + " ";
102
101
  }
103
- }
102
+ `
104
103
 
105
104
  # %x{
106
105
  # start_comment.innerText = " $" + new_name + " ";
@@ -111,7 +110,7 @@ module Volt
111
110
  end
112
111
  end
113
112
 
114
- return new_bindings
113
+ new_bindings
115
114
  end
116
115
  end
117
116
  end
@@ -6,15 +6,15 @@ module Volt
6
6
  NO_XPATH = false
7
7
  end
8
8
 
9
- def find_by_comment(text, in_node=`document`)
9
+ def find_by_comment(text, in_node = `document`)
10
10
  if NO_XPATH
11
11
  return find_by_comment_without_xml(text, in_node)
12
12
  else
13
13
  node = nil
14
14
 
15
- %x{
15
+ `
16
16
  node = document.evaluate("//comment()[. = ' " + text + " ']", in_node, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null).iterateNext();
17
- }
17
+ `
18
18
  return node
19
19
  end
20
20
  end
@@ -22,7 +22,7 @@ module Volt
22
22
  # PhantomJS does not support xpath in document.evaluate
23
23
  def find_by_comment_without_xml(text, in_node)
24
24
  match_text = " #{text} "
25
- %x{
25
+ `
26
26
  function walk(node) {
27
27
  if (node.nodeType === 8 && node.nodeValue === match_text) {
28
28
  return node;
@@ -44,15 +44,14 @@ module Volt
44
44
 
45
45
  return walk(in_node);
46
46
 
47
- }
47
+ `
48
48
  end
49
49
 
50
-
51
50
  # Returns an unattached div with the nodes from the passed
52
51
  # in html.
53
52
  def build_from_html(html)
54
53
  temp_div = nil
55
- %x{
54
+ `
56
55
  temp_div = document.createElement('div');
57
56
  var doc = jQuery.parseHTML(html);
58
57
 
@@ -61,7 +60,7 @@ module Volt
61
60
  temp_div.appendChild(doc[i]);
62
61
  }
63
62
  }
64
- }
63
+ `
65
64
  temp_div
66
65
  end
67
66
  end
@@ -27,7 +27,6 @@ module Volt
27
27
  promise
28
28
  end
29
29
 
30
-
31
30
  def received_message(name, promise_id, *args)
32
31
  case name
33
32
  when 'added', 'removed', 'updated', 'changed'
@@ -9,7 +9,7 @@ module Volt
9
9
 
10
10
  @sub_bindings = []
11
11
 
12
- bindings = self.dom_section.set_content_to_template(page, template_name)
12
+ bindings = dom_section.set_content_to_template(page, template_name)
13
13
 
14
14
  bindings.each_pair do |id, bindings_for_id|
15
15
  bindings_for_id.each do |binding|
@@ -11,7 +11,7 @@ module Volt
11
11
 
12
12
  # Setup popstate on the dom ready event. Prevents an extra
13
13
  # popstate trigger
14
- %x{
14
+ `
15
15
  var first = true;
16
16
  window.addEventListener("popstate", function(e) {
17
17
  if (first === false) {
@@ -22,11 +22,11 @@ module Volt
22
22
 
23
23
  return true;
24
24
  });
25
- }
25
+ `
26
26
  end
27
27
  end
28
28
 
29
- def url_updated(first_call=false)
29
+ def url_updated(first_call = false)
30
30
  @page.url.parse(`document.location.href`)
31
31
  @page.url.update! unless first_call
32
32
  end
@@ -61,9 +61,7 @@ module Volt
61
61
  invalidations = @invalidations
62
62
  @invalidations = []
63
63
 
64
- invalidations.each do |invalidation|
65
- invalidation.call
66
- end
64
+ invalidations.each(&:call)
67
65
  end
68
66
  end
69
67
 
@@ -92,9 +90,8 @@ module Volt
92
90
  return_value
93
91
  end
94
92
 
95
-
96
93
  def self.flush!
97
- raise "Can't flush while in a flush" if @flushing
94
+ fail "Can't flush while in a flush" if @flushing
98
95
 
99
96
  @flushing = true
100
97
  # clear any timers
@@ -103,15 +100,13 @@ module Volt
103
100
  computations = @@flush_queue
104
101
  @@flush_queue = []
105
102
 
106
- computations.each do |computation|
107
- computation.compute!
108
- end
103
+ computations.each(&:compute!)
109
104
 
110
105
  @flushing = false
111
106
  end
112
107
 
113
108
  def self.queue_flush!
114
- if !@timer
109
+ unless @timer
115
110
  # Flush once everything else has finished running
116
111
  @timer = `setImmediate(function() { self['$flush!'](); });`
117
112
  end
@@ -119,12 +114,11 @@ module Volt
119
114
  end
120
115
  end
121
116
 
122
-
123
117
  class Proc
124
118
  def watch!
125
119
  Volt::Computation.new(self).run_in do
126
120
  # run self
127
- self.call
121
+ call
128
122
  end
129
123
  end
130
124
  end
@@ -59,9 +59,7 @@ module Volt
59
59
 
60
60
  @dependencies = Set.new
61
61
 
62
- deps.each do |dep|
63
- dep.invalidate!
64
- end
62
+ deps.each(&:invalidate!)
65
63
  end
66
64
 
67
65
  # Called when a dependency is no longer needed
@@ -1,4 +1,6 @@
1
1
  module Volt
2
+ # Listeners are returned from #on on a class with Eventable included.
3
+ # Listeners can be stopped by calling #remove
2
4
  class Listener
3
5
  def initialize(klass, event, callback)
4
6
  @klass = klass
@@ -25,7 +27,14 @@ module Volt
25
27
  end
26
28
  end
27
29
 
30
+ # Include Eventable to add a basic event/trigger system to a class. Listeners can be
31
+ # added with #on(event_name) { ... } Events can be triggered with #trigger!
28
32
  module Eventable
33
+ # Sets up a listener on the class the Eventable module was included in.
34
+ # event should be a string or symbol. When something calls #trigger!(event_name) on
35
+ # the class, it will trigger any listener with the same event name.
36
+ #
37
+ # returns: a listener that has a #remove method to stop the listener.
29
38
  def on(event, &callback)
30
39
  event = event.to_sym
31
40
  listener = Listener.new(self, event, callback)
@@ -40,12 +49,14 @@ module Volt
40
49
  if self.respond_to?(:event_added)
41
50
  # call event added passing the event, the scope, and a boolean if it
42
51
  # is the first time this event has been added.
43
- self.event_added(event, first, first_for_event)
52
+ event_added(event, first, first_for_event)
44
53
  end
45
54
 
46
- return listener
55
+ listener
47
56
  end
48
57
 
58
+ # Triggers event on the class the module was includeded. Any .on listeners
59
+ # will have their block called passing in *args.
49
60
  def trigger!(event, *args)
50
61
  event = event.to_sym
51
62
 
@@ -58,10 +69,12 @@ module Volt
58
69
  end
59
70
  end
60
71
 
72
+ # Stops the listener returned by calling .on(:event_name) Triggers #event_removed
73
+ # if there are no more listeners for that event.
61
74
  def remove_listener(event, listener)
62
75
  event = event.to_sym
63
76
 
64
- raise "Unable to delete #{event} from #{self.inspect}" unless @listeners && @listeners[event]
77
+ fail "Unable to delete #{event} from #{inspect}" unless @listeners && @listeners[event]
65
78
 
66
79
  @listeners[event].delete(listener)
67
80
 
@@ -77,7 +90,7 @@ module Volt
77
90
  # Let the class we're included on know that we removed a listener (if it cares)
78
91
  if self.respond_to?(:event_removed)
79
92
  # Pass in the event and a boolean indicating if it is the last event
80
- self.event_removed(event, last, last_for_event)
93
+ event_removed(event, last, last_for_event)
81
94
  end
82
95
  end
83
96
  end
@@ -30,6 +30,7 @@ module Volt
30
30
  end
31
31
 
32
32
  private
33
+
33
34
  def ensure_key(key)
34
35
  @hash_depedencies[key] ||= Dependency.new
35
36
  end
@@ -1,6 +1,5 @@
1
1
  module Volt
2
2
  module ReactiveAccessors
3
-
4
3
  module ClassMethods
5
4
  # Create a method to read a reactive value from an instance value. If it
6
5
  # is not setup, create it so it can be updated through the reactive value
@@ -4,7 +4,7 @@ module Volt
4
4
  class ReactiveArray
5
5
  include Eventable
6
6
 
7
- def initialize(array=[])
7
+ def initialize(array = [])
8
8
  @array = array
9
9
  @array_deps = []
10
10
  @size_dep = Dependency.new
@@ -49,7 +49,7 @@ module Volt
49
49
  end
50
50
  end
51
51
 
52
- return result
52
+ result
53
53
  end
54
54
 
55
55
  def any?
@@ -73,7 +73,7 @@ module Volt
73
73
  size.times do |index|
74
74
  val = self[index]
75
75
 
76
- if !yield(val).true?
76
+ unless yield(val).true?
77
77
  return false
78
78
  end
79
79
  end
@@ -96,11 +96,10 @@ module Volt
96
96
  dep.depend
97
97
 
98
98
  # Return the index
99
- return @array[index]
99
+ @array[index]
100
100
  end
101
101
 
102
102
  def []=(index, value)
103
-
104
103
  # Assign the new value
105
104
  @array[index] = value
106
105
 
@@ -112,10 +111,10 @@ module Volt
112
111
  def size
113
112
  @size_dep.depend
114
113
 
115
- return @array.size
114
+ @array.size
116
115
  end
117
116
 
118
- alias :length :size
117
+ alias_method :length, :size
119
118
 
120
119
  def delete_at(index)
121
120
  # Handle a negative index
@@ -131,7 +130,7 @@ module Volt
131
130
 
132
131
  # Trigger a changed event for each element in the zone where the
133
132
  # delete would change
134
- index.upto(self.size+1) do |position|
133
+ index.upto(size + 1) do |position|
135
134
  trigger_for_index!(position)
136
135
  end
137
136
 
@@ -139,14 +138,13 @@ module Volt
139
138
 
140
139
  @persistor.removed(model) if @persistor
141
140
 
142
- return model
141
+ model
143
142
  end
144
143
 
145
-
146
144
  def delete(val)
147
145
  index = @array.index(val)
148
146
  if index
149
- self.delete_at(index)
147
+ delete_at(index)
150
148
  else
151
149
  # Sometimes the model isn't loaded at the right state yet, so we
152
150
  # just remove it from the persistor
@@ -180,29 +178,28 @@ module Volt
180
178
  def <<(value)
181
179
  result = (@array << value)
182
180
 
183
- trigger_for_index!(self.size-1)
184
- trigger_added!(self.size-1)
181
+ trigger_for_index!(size - 1)
182
+ trigger_added!(size - 1)
185
183
  trigger_size_change!
186
184
 
187
- return result
185
+ result
188
186
  end
189
187
 
190
-
191
188
  def +(array)
192
- raise "not implemented yet"
193
- old_size = self.size
189
+ fail 'not implemented yet'
190
+ old_size = size
194
191
 
195
192
  # TODO: += is funky here, might need to make a .plus! method
196
193
  result = ReactiveArray.new(@array.dup + array)
197
194
 
198
- old_size.upto(result.size-1) do |index|
195
+ old_size.upto(result.size - 1) do |index|
199
196
  trigger_for_index!('changed', index)
200
197
  trigger_added!(old_size + index)
201
198
  end
202
199
 
203
200
  trigger_size_change!
204
201
 
205
- return result
202
+ result
206
203
  end
207
204
 
208
205
  def insert(index, *objects)
@@ -214,21 +211,20 @@ module Volt
214
211
  end
215
212
 
216
213
  objects.size.times do |count|
217
- trigger_added!(index+count)
214
+ trigger_added!(index + count)
218
215
  end
219
216
 
220
217
  trigger_size_change!
221
218
 
222
- return result
219
+ result
223
220
  end
224
221
 
225
-
226
222
  def inspect
227
- "#<#{self.class.to_s}:#{object_id} #{@array.inspect}>"
223
+ "#<#{self.class}:#{object_id} #{@array.inspect}>"
228
224
  end
229
225
 
230
-
231
226
  private
227
+
232
228
  # Check to see if the size has changed, trigger a change on size if it has
233
229
  def trigger_size_change!
234
230
  new_size = @array.size
@@ -245,7 +241,6 @@ module Volt
245
241
  dep.changed! if dep
246
242
  end
247
243
 
248
-
249
244
  def trigger_added!(index)
250
245
  trigger!('added', index)
251
246
  end