volt 0.9.1 → 0.9.2

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 (156) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +56 -0
  3. data/CHANGELOG.md +4 -0
  4. data/Rakefile +0 -1
  5. data/app/volt/models/user.rb +1 -3
  6. data/app/volt/tasks/live_query/live_query.rb +1 -1
  7. data/app/volt/tasks/store_tasks.rb +4 -5
  8. data/app/volt/tasks/user_tasks.rb +1 -1
  9. data/lib/volt.rb +2 -6
  10. data/lib/volt/boot.rb +0 -2
  11. data/lib/volt/cli.rb +0 -1
  12. data/lib/volt/cli/asset_compile.rb +0 -2
  13. data/lib/volt/cli/console.rb +3 -4
  14. data/lib/volt/cli/generate.rb +3 -4
  15. data/lib/volt/cli/new_gem.rb +1 -3
  16. data/lib/volt/controllers/actions.rb +6 -6
  17. data/lib/volt/controllers/model_controller.rb +4 -8
  18. data/lib/volt/data_stores/base.rb +1 -2
  19. data/lib/volt/data_stores/data_store.rb +2 -2
  20. data/lib/volt/data_stores/mongo_driver.rb +3 -3
  21. data/lib/volt/extra_core/hash.rb +1 -1
  22. data/lib/volt/extra_core/inflector/inflections.rb +10 -2
  23. data/lib/volt/extra_core/logger.rb +1 -4
  24. data/lib/volt/extra_core/object.rb +1 -1
  25. data/lib/volt/models.rb +2 -4
  26. data/lib/volt/models/array_model.rb +3 -7
  27. data/lib/volt/models/associations.rb +5 -4
  28. data/lib/volt/models/buffer.rb +1 -2
  29. data/lib/volt/models/dirty.rb +2 -2
  30. data/lib/volt/models/errors.rb +1 -1
  31. data/lib/volt/models/listener_tracker.rb +1 -3
  32. data/lib/volt/models/model.rb +16 -20
  33. data/lib/volt/models/permissions.rb +15 -18
  34. data/lib/volt/models/persistors/array_store.rb +5 -10
  35. data/lib/volt/models/persistors/cookies.rb +2 -2
  36. data/lib/volt/models/persistors/model_store.rb +3 -9
  37. data/lib/volt/models/persistors/params.rb +1 -3
  38. data/lib/volt/models/persistors/query/normalizer.rb +3 -3
  39. data/lib/volt/models/persistors/query/query_listener.rb +1 -1
  40. data/lib/volt/models/persistors/store.rb +2 -2
  41. data/lib/volt/models/state_helpers.rb +1 -1
  42. data/lib/volt/models/state_manager.rb +4 -4
  43. data/lib/volt/models/url.rb +2 -6
  44. data/lib/volt/models/validations.rb +8 -13
  45. data/lib/volt/models/validators/numericality_validator.rb +2 -6
  46. data/lib/volt/models/validators/unique_validator.rb +1 -1
  47. data/lib/volt/models/validators/user_validation.rb +0 -1
  48. data/lib/volt/page/bindings/attribute_binding.rb +9 -19
  49. data/lib/volt/page/bindings/content_binding.rb +1 -1
  50. data/lib/volt/page/bindings/each_binding.rb +3 -4
  51. data/lib/volt/page/bindings/if_binding.rb +1 -1
  52. data/lib/volt/page/bindings/view_binding.rb +15 -22
  53. data/lib/volt/page/bindings/view_binding/controller_handler.rb +5 -7
  54. data/lib/volt/page/bindings/view_binding/view_lookup_for_path.rb +1 -2
  55. data/lib/volt/page/bindings/yield_binding.rb +1 -2
  56. data/lib/volt/page/channel.rb +3 -3
  57. data/lib/volt/page/document_events.rb +1 -1
  58. data/lib/volt/page/page.rb +3 -6
  59. data/lib/volt/page/path_string_renderer.rb +7 -8
  60. data/lib/volt/page/sub_context.rb +1 -3
  61. data/lib/volt/page/targets/binding_document/component_node.rb +1 -3
  62. data/lib/volt/page/tasks.rb +3 -5
  63. data/lib/volt/reactive/class_eventable.rb +2 -2
  64. data/lib/volt/reactive/computation.rb +7 -7
  65. data/lib/volt/reactive/dependency.rb +1 -1
  66. data/lib/volt/reactive/eventable.rb +3 -4
  67. data/lib/volt/reactive/reactive_accessors.rb +0 -1
  68. data/lib/volt/reactive/reactive_array.rb +4 -12
  69. data/lib/volt/router/routes.rb +1 -3
  70. data/lib/volt/server.rb +6 -6
  71. data/lib/volt/server/component_handler.rb +1 -1
  72. data/lib/volt/server/component_templates.rb +2 -2
  73. data/lib/volt/server/forking_server.rb +6 -9
  74. data/lib/volt/server/html_parser/component_view_scope.rb +2 -2
  75. data/lib/volt/server/html_parser/each_scope.rb +1 -1
  76. data/lib/volt/server/html_parser/sandlebars_parser.rb +2 -6
  77. data/lib/volt/server/html_parser/view_handler.rb +1 -1
  78. data/lib/volt/server/html_parser/view_parser.rb +1 -1
  79. data/lib/volt/server/html_parser/view_scope.rb +2 -4
  80. data/lib/volt/server/rack/asset_files.rb +1 -3
  81. data/lib/volt/server/rack/component_paths.rb +1 -3
  82. data/lib/volt/server/rack/http_request.rb +1 -3
  83. data/lib/volt/server/rack/http_resource.rb +1 -3
  84. data/lib/volt/server/rack/http_response_renderer.rb +2 -2
  85. data/lib/volt/server/rack/index_files.rb +1 -1
  86. data/lib/volt/server/rack/opal_files.rb +1 -3
  87. data/lib/volt/server/socket_connection_handler.rb +1 -3
  88. data/lib/volt/server/websocket/rack_server_adaptor.rb +1 -1
  89. data/lib/volt/server/websocket/websocket_handler.rb +1 -2
  90. data/lib/volt/spec/capybara.rb +1 -1
  91. data/lib/volt/spec/setup.rb +18 -12
  92. data/lib/volt/tasks/dispatcher.rb +1 -2
  93. data/lib/volt/tasks/task_handler.rb +1 -3
  94. data/lib/volt/utils/boolean_patch.rb +1 -1
  95. data/lib/volt/utils/event_counter.rb +2 -2
  96. data/lib/volt/utils/generic_pool.rb +5 -9
  97. data/lib/volt/utils/logging/task_argument_filterer.rb +4 -4
  98. data/lib/volt/utils/logging/task_logger.rb +2 -2
  99. data/lib/volt/utils/modes.rb +2 -2
  100. data/lib/volt/utils/promise_patch.rb +1 -2
  101. data/lib/volt/utils/read_write_lock.rb +21 -23
  102. data/lib/volt/utils/tilt_patch.rb +1 -1
  103. data/lib/volt/utils/timers.rb +3 -7
  104. data/lib/volt/utils/volt_user_error.rb +1 -1
  105. data/lib/volt/version.rb +2 -2
  106. data/lib/volt/volt/app.rb +4 -6
  107. data/lib/volt/volt/users.rb +4 -3
  108. data/spec/apps/kitchen_sink/app/main/controllers/main_controller.rb +1 -1
  109. data/spec/apps/kitchen_sink/app/main/controllers/server/simple_http_controller.rb +1 -1
  110. data/spec/apps/kitchen_sink/app/main/controllers/todos_controller.rb +5 -5
  111. data/spec/apps/kitchen_sink/app/main/controllers/upload_controller.rb +1 -1
  112. data/spec/apps/kitchen_sink/app/main/controllers/yield_component_controller.rb +1 -1
  113. data/spec/controllers/actions_spec.rb +9 -10
  114. data/spec/controllers/model_controller_spec.rb +1 -1
  115. data/spec/extra_core/blank_spec.rb +2 -2
  116. data/spec/extra_core/logger_spec.rb +6 -8
  117. data/spec/extra_core/string_transformations_spec.rb +3 -3
  118. data/spec/integration/bindings_spec.rb +3 -9
  119. data/spec/integration/first_last_spec.rb +1 -1
  120. data/spec/integration/missing_spec.rb +1 -2
  121. data/spec/integration/raw_html_binding.rb +2 -2
  122. data/spec/integration/todos_spec.rb +22 -0
  123. data/spec/integration/yield_spec.rb +2 -2
  124. data/spec/models/associations_spec.rb +4 -4
  125. data/spec/models/buffer_spec.rb +2 -2
  126. data/spec/models/dirty_spec.rb +10 -11
  127. data/spec/models/model_spec.rb +19 -13
  128. data/spec/models/model_state_spec.rb +1 -1
  129. data/spec/models/permissions_spec.rb +8 -12
  130. data/spec/models/url_spec.rb +1 -1
  131. data/spec/models/user_spec.rb +17 -10
  132. data/spec/models/user_validation_spec.rb +2 -3
  133. data/spec/models/validations_spec.rb +7 -10
  134. data/spec/models/validators/email_validator_spec.rb +5 -7
  135. data/spec/models/validators/format_validator_spec.rb +21 -3
  136. data/spec/models/validators/length_validator_spec.rb +12 -22
  137. data/spec/models/validators/shared_examples_for_validators.rb +1 -1
  138. data/spec/models/validators/unique_validator_spec.rb +1 -2
  139. data/spec/page/bindings/content_binding_spec.rb +1 -1
  140. data/spec/page/bindings/template_binding/view_lookup_for_path_spec.rb +0 -1
  141. data/spec/page/path_string_renderer_spec.rb +2 -3
  142. data/spec/reactive/class_eventable_spec.rb +1 -1
  143. data/spec/reactive/computation_spec.rb +30 -31
  144. data/spec/reactive/reactive_hash_spec.rb +1 -1
  145. data/spec/router/routes_spec.rb +14 -16
  146. data/spec/server/html_parser/view_handler_spec.rb +1 -1
  147. data/spec/server/html_parser/view_parser_spec.rb +0 -1
  148. data/spec/server/rack/quite_common_logger_spec.rb +3 -3
  149. data/spec/tasks/dispatcher_spec.rb +1 -1
  150. data/spec/tasks/query_tracker_spec.rb +1 -3
  151. data/spec/utils/task_argument_filtererer_spec.rb +5 -5
  152. data/templates/project/app/main/controllers/main_controller.rb +1 -1
  153. data/templates/project/spec/app/main/models/sample_model_spec.rb +2 -2
  154. data/templates/project/spec/app/main/tasks/sample_task_spec.rb +2 -2
  155. data/volt.gemspec +3 -5
  156. metadata +19 -4
@@ -7,7 +7,7 @@ module Volt
7
7
  @action = action.to_sym if action
8
8
  end
9
9
 
10
- def call_action(stage_prefix=nil, stage_suffix=nil)
10
+ def call_action(stage_prefix = nil, stage_suffix = nil)
11
11
  return unless @action
12
12
 
13
13
  has_stage = stage_prefix || stage_suffix
@@ -31,19 +31,17 @@ module Volt
31
31
  end
32
32
  end
33
33
 
34
- if @controller.respond_to?(method_name)
35
- @controller.send(method_name)
36
- end
34
+ @controller.send(method_name) if @controller.respond_to?(method_name)
37
35
 
38
36
  @controller.run_actions(:after, @action) unless has_stage
39
37
 
40
38
  # before_action chain was not stopped
41
- return false
39
+ false
42
40
  end
43
41
 
44
42
  # Fetch the controller class
45
43
  def self.get_controller_and_action(controller_path)
46
- raise "Invalid controller path: #{controller_path.inspect}" unless controller_path && controller_path.size > 0
44
+ fail "Invalid controller path: #{controller_path.inspect}" unless controller_path && controller_path.size > 0
47
45
 
48
46
  action = controller_path[-1]
49
47
 
@@ -65,4 +63,4 @@ module Volt
65
63
  [obj, action]
66
64
  end
67
65
  end
68
- end
66
+ end
@@ -87,6 +87,5 @@ module Volt
87
87
 
88
88
  [nil, nil]
89
89
  end
90
-
91
90
  end
92
- end
91
+ end
@@ -25,7 +25,6 @@ module Volt
25
25
  end
26
26
 
27
27
  super
28
-
29
28
  end
30
29
  end
31
- end
30
+ end
@@ -27,7 +27,7 @@ module Volt
27
27
  end
28
28
 
29
29
  def connect!
30
- %x{
30
+ `
31
31
  if (document.location.protocol == 'https:') {
32
32
  var wsProto = 'wss';
33
33
  } else {
@@ -53,7 +53,7 @@ module Volt
53
53
  this.socket.onclose = function(error) {
54
54
  self.$closed(error);
55
55
  };
56
- }
56
+ `
57
57
  end
58
58
 
59
59
  def opened
@@ -78,7 +78,7 @@ module Volt
78
78
  self.status = :reconnecting
79
79
  self.reconnect_interval ||= 0
80
80
  self.reconnect_interval += (1000 + rand(5000))
81
- self.retry_count += 1
81
+ self.retry_count += 1
82
82
 
83
83
  interval = self.reconnect_interval
84
84
 
@@ -22,7 +22,7 @@ module Volt
22
22
 
23
23
  end
24
24
 
25
- @events[event][binding.binding_name] ||= {}
25
+ @events[event][binding.binding_name] ||= {}
26
26
  @events[event][binding.binding_name][binding.object_id] = handler
27
27
  end
28
28
 
@@ -27,7 +27,6 @@ require 'volt/page/url_tracker'
27
27
  require 'volt/benchmark/benchmark'
28
28
  require 'volt/page/tasks'
29
29
 
30
-
31
30
  module Volt
32
31
  class Page
33
32
  attr_reader :url, :params, :page, :routes, :events
@@ -151,9 +150,7 @@ module Volt
151
150
 
152
151
  # On the server, we can delay loading the views until they are actually requeted. This
153
152
  # sets up an instance variable to call to load.
154
- def template_loader=(callback)
155
- @template_loader = callback
156
- end
153
+ attr_writer :template_loader
157
154
 
158
155
  def templates
159
156
  if @template_loader
@@ -166,7 +163,7 @@ module Volt
166
163
  end
167
164
 
168
165
  def add_routes(&block)
169
- @routes ||= Routes.new
166
+ @routes ||= Routes.new
170
167
  @routes.define(&block)
171
168
  @url.router = @routes
172
169
  end
@@ -221,7 +218,7 @@ module Volt
221
218
  $page = Page.new
222
219
 
223
220
  `$(document).ready(function() {`
224
- $page.start
221
+ $page.start
225
222
  `});`
226
223
  end
227
224
  end
@@ -6,27 +6,27 @@ require 'volt/page/bindings/view_binding/controller_handler'
6
6
  require 'volt/page/string_template_renderer'
7
7
 
8
8
  module Volt
9
- class ViewLookupException < Exception ; end
9
+ class ViewLookupException < Exception; end
10
10
  class PathStringRenderer
11
11
  attr_reader :html
12
- def initialize(path, attrs=nil, page=nil, render_from_path=nil)
12
+ def initialize(path, attrs = nil, page = nil, render_from_path = nil)
13
13
  # use the global page if one is not passed in
14
14
  page ||= $page
15
15
 
16
16
  # where to do the path lookup from
17
- render_from_path ||= "main/main/main/body"
17
+ render_from_path ||= 'main/main/main/body'
18
18
 
19
19
  # Make path into a full path
20
20
  @view_lookup = Volt::ViewLookupForPath.new(page, render_from_path)
21
21
  full_path, controller_path = @view_lookup.path_for_template(path, nil)
22
22
 
23
- if full_path == nil
24
- raise ViewLookupException, "Unable to find view at `#{path}`"
23
+ if full_path.nil?
24
+ fail ViewLookupException, "Unable to find view at `#{path}`"
25
25
  end
26
26
 
27
27
  controller_class, action = ControllerHandler.get_controller_and_action(controller_path)
28
28
 
29
- controller = controller_class.new#(SubContext.new(attrs, nil, true))
29
+ controller = controller_class.new # (SubContext.new(attrs, nil, true))
30
30
  controller.model = SubContext.new(attrs, nil, true)
31
31
 
32
32
  renderer = StringTemplateRenderer.new(page, controller, full_path)
@@ -36,6 +36,5 @@ module Volt
36
36
  # remove when done
37
37
  renderer.remove
38
38
  end
39
-
40
39
  end
41
- end
40
+ end
@@ -28,9 +28,7 @@ module Volt
28
28
  obj = @locals[method_name]
29
29
 
30
30
  # TODORW: Might get a normal proc, flag internal procs
31
- if obj.is_a?(Proc)
32
- obj = obj.call(*args)
33
- end
31
+ obj = obj.call(*args) if obj.is_a?(Proc)
34
32
  return obj
35
33
  elsif @return_nils && method_name[-1] != '='
36
34
  return nil
@@ -75,9 +75,7 @@ module Volt
75
75
  end
76
76
 
77
77
  def find_by_binding_id(binding_id)
78
- if @binding_id == binding_id
79
- return self
80
- end
78
+ return self if @binding_id == binding_id
81
79
 
82
80
  @nodes.each do |node|
83
81
  if node.is_a?(ComponentNode)
@@ -14,7 +14,7 @@ module Volt
14
14
 
15
15
  def call(class_name, method_name, meta_data, *args)
16
16
  promise_id = @promise_id
17
- @promise_id += 1
17
+ @promise_id += 1
18
18
 
19
19
  # Track the callback
20
20
  promise = Promise.new
@@ -45,7 +45,7 @@ module Volt
45
45
  if promise
46
46
  if error
47
47
  # TODO: full error handling
48
- Volt.logger.error("Task Response:")
48
+ Volt.logger.error('Task Response:')
49
49
  Volt.logger.error(error.inspect)
50
50
  promise.reject(error)
51
51
  else
@@ -67,9 +67,7 @@ module Volt
67
67
 
68
68
  # If this browser supports session storage, store the page, so it will
69
69
  # be in the same state when we reload.
70
- if `sessionStorage`
71
- `sessionStorage.setItem('___page', value);`
72
- end
70
+ `sessionStorage.setItem('___page', value);` if `sessionStorage`
73
71
 
74
72
  $page.page._reloading = true
75
73
  `window.location.reload(false);`
@@ -17,7 +17,7 @@ module Volt
17
17
  # events at the class level. When the event triggers, self will be set to the
18
18
  # instance it was triggered on.
19
19
  def on(*events, &callback)
20
- raise '.on requires an event' if events.size == 0
20
+ fail '.on requires an event' if events.size == 0
21
21
 
22
22
  listener = Listener.new(self, events, callback)
23
23
 
@@ -68,4 +68,4 @@ module Volt
68
68
  base.send :include, InstanceMethods
69
69
  end
70
70
  end
71
- end
71
+ end
@@ -41,8 +41,8 @@ module Volt
41
41
  if @invalidated
42
42
  # Call invalidate now, since its already invalidated
43
43
  # Computation.run_without_tracking do
44
- queue_flush!
45
- callback.call
44
+ queue_flush!
45
+ callback.call
46
46
  # end
47
47
  else
48
48
  # Store the invalidation
@@ -146,9 +146,9 @@ class Proc
146
146
  # @param the value to match
147
147
  # @return [Volt::Computation] the initial computation is returned.
148
148
  def watch_until!(value, &block)
149
- computation = Proc.new do |comp|
149
+ computation = proc do |comp|
150
150
  # First fetch the value
151
- result = self.call
151
+ result = call
152
152
 
153
153
  if result == value
154
154
  # Values match
@@ -174,11 +174,11 @@ class Proc
174
174
  # -> { }
175
175
  def watch_and_resolve!
176
176
  unless block_given?
177
- raise "watch_and_resolve! requires a block to call when the value is resolved or another value other than a promise is returned in the watch."
177
+ fail 'watch_and_resolve! requires a block to call when the value is resolved or another value other than a promise is returned in the watch.'
178
178
  end
179
179
 
180
- computation = Proc.new do
181
- result = self.call
180
+ computation = proc do
181
+ result = call
182
182
 
183
183
  if result.is_a?(Promise)
184
184
  result.then do |final|
@@ -36,7 +36,7 @@ module Volt
36
36
  # on this dependency.
37
37
  # @param on_stop_dep [Proc] a proc to be called when no computations are depending
38
38
  # on this dependency anymore.
39
- def initialize(on_dep=nil, on_stop_dep=nil)
39
+ def initialize(on_dep = nil, on_stop_dep = nil)
40
40
  @dependencies = Set.new
41
41
  @on_dep = on_dep
42
42
  @on_stop_dep = on_stop_dep
@@ -18,7 +18,7 @@ module Volt
18
18
  end
19
19
 
20
20
  def remove
21
- raise "Listener has already been removed" if @removed
21
+ fail 'Listener has already been removed' if @removed
22
22
  @removed = true
23
23
 
24
24
  @events.each do |event|
@@ -44,11 +44,11 @@ module Volt
44
44
  #
45
45
  # returns: a listener that has a #remove method to stop the listener.
46
46
  def on(*events, &callback)
47
- raise '.on requires an event' if events.size == 0
47
+ fail '.on requires an event' if events.size == 0
48
48
 
49
49
  listener = Listener.new(self, events, callback)
50
50
 
51
- @listeners ||= {}
51
+ @listeners ||= {}
52
52
 
53
53
  events.each do |event|
54
54
  event = event.to_sym
@@ -69,7 +69,6 @@ module Volt
69
69
  listener
70
70
  end
71
71
 
72
-
73
72
  # Triggers event on the class the module was includeded. Any .on listeners
74
73
  # will have their block called passing in *args.
75
74
  def trigger!(event, *args)
@@ -42,6 +42,5 @@ module Volt
42
42
  value_dep = instance_variable_get(:"@__#{var_name}_dependency")
43
43
  value_dep ||= instance_variable_set(:"@__#{var_name}_dependency", Dependency.new)
44
44
  end
45
-
46
45
  end
47
46
  end
@@ -40,9 +40,7 @@ module Volt
40
40
  count = 0
41
41
 
42
42
  size.times do |index|
43
- if block.call(self[index])
44
- count += 1
45
- end
43
+ count += 1 if block.call(self[index])
46
44
  end
47
45
 
48
46
  count
@@ -55,9 +53,7 @@ module Volt
55
53
  result = []
56
54
  size.times do |index|
57
55
  val = self[index]
58
- if yield(val)
59
- result << val
60
- end
56
+ result << val if yield(val)
61
57
  end
62
58
 
63
59
  result
@@ -68,9 +64,7 @@ module Volt
68
64
  size.times do |index|
69
65
  val = self[index]
70
66
 
71
- if yield(val)
72
- return true
73
- end
67
+ return true if yield(val)
74
68
  end
75
69
 
76
70
  false
@@ -84,9 +78,7 @@ module Volt
84
78
  size.times do |index|
85
79
  val = self[index]
86
80
 
87
- unless yield(val)
88
- return false
89
- end
81
+ return false unless yield(val)
90
82
  end
91
83
 
92
84
  true
@@ -275,9 +275,7 @@ module Volt
275
275
  return false
276
276
  end
277
277
  elsif value.nil?
278
- unless test_params.key?(key)
279
- return false
280
- end
278
+ return false unless test_params.key?(key)
281
279
  else
282
280
  if test_params[key] == value
283
281
  test_params.delete(key)
data/lib/volt/server.rb CHANGED
@@ -135,12 +135,12 @@ module Volt
135
135
  @rack_app.use HttpResource, @volt_app.router
136
136
 
137
137
  @rack_app.use Rack::Static,
138
- urls: ['/'],
139
- root: 'config/base',
140
- index: '',
141
- header_rules: [
142
- [:all, { 'Cache-Control' => 'public, max-age=86400' }]
143
- ]
138
+ urls: ['/'],
139
+ root: 'config/base',
140
+ index: '',
141
+ header_rules: [
142
+ [:all, { 'Cache-Control' => 'public, max-age=86400' }]
143
+ ]
144
144
 
145
145
  @rack_app.run lambda { |env| [404, { 'Content-Type' => 'text/html; charset=utf-8' }, ['404 - page not found']] }
146
146
 
@@ -23,7 +23,7 @@ module Volt
23
23
  [200, { 'Content-Type' => 'application/javascript; charset=utf-8' }, StringIO.new(javascript_code)]
24
24
  end
25
25
 
26
- def compile_for_component(component_name, for_client, map=false)
26
+ def compile_for_component(component_name, for_client, map = false)
27
27
  code = ComponentCode.new(component_name, @component_paths, for_client).code
28
28
 
29
29
  # Compile the code
@@ -112,9 +112,9 @@ module Volt
112
112
  parts = ["class #{klass_parts.pop} < Volt::Task; end"]
113
113
 
114
114
  # Work backwards on the modules
115
- klass_parts.reverse.each do |kpart|
115
+ klass_parts.reverse_each do |kpart|
116
116
  parts.unshift("module #{kpart}")
117
- parts.push("end")
117
+ parts.push('end')
118
118
  end
119
119
 
120
120
  # Combine the parts
@@ -14,7 +14,7 @@ module Volt
14
14
  at_exit do
15
15
  # Only run on parent
16
16
  if @child_id
17
- puts "Exiting..."
17
+ puts 'Exiting...'
18
18
  @exiting = true
19
19
  stop_child
20
20
  end
@@ -85,7 +85,7 @@ module Volt
85
85
  Thread.new do
86
86
  loop do
87
87
  if @writer.closed?
88
- puts "Parent process died"
88
+ puts 'Parent process died'
89
89
  exit
90
90
  end
91
91
 
@@ -146,12 +146,10 @@ module Volt
146
146
 
147
147
  def reload(changed_files)
148
148
  # only reload the server code if a non-view file was changed
149
- server_code_changed = changed_files.any? {|path| File.extname(path) == '.rb' }
149
+ server_code_changed = changed_files.any? { |path| File.extname(path) == '.rb' }
150
150
 
151
151
  msg = 'file changed, reloading'
152
- if server_code_changed
153
- msg << ' server and'
154
- end
152
+ msg << ' server and' if server_code_changed
155
153
  msg << ' client...'
156
154
 
157
155
  Volt.logger.log_with_color(msg, :light_blue)
@@ -159,7 +157,7 @@ module Volt
159
157
  begin
160
158
  SocketConnectionHandler.send_message_all(nil, 'reload')
161
159
  rescue => e
162
- Volt.logger.error("Reload dispatch error: ")
160
+ Volt.logger.error('Reload dispatch error: ')
163
161
  Volt.logger.error(e)
164
162
  end
165
163
 
@@ -185,6 +183,5 @@ module Volt
185
183
  def stop_change_listener
186
184
  @listener.stop
187
185
  end
188
-
189
186
  end
190
- end
187
+ end