actionview 5.0.7.2 → 5.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionview might be problematic. Click here for more details.

Files changed (82) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +92 -384
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +1 -1
  5. data/lib/action_view.rb +5 -5
  6. data/lib/action_view/base.rb +19 -19
  7. data/lib/action_view/buffers.rb +1 -1
  8. data/lib/action_view/context.rb +1 -1
  9. data/lib/action_view/dependency_tracker.rb +4 -5
  10. data/lib/action_view/digestor.rb +6 -7
  11. data/lib/action_view/flows.rb +5 -6
  12. data/lib/action_view/gem_version.rb +3 -3
  13. data/lib/action_view/helpers.rb +1 -1
  14. data/lib/action_view/helpers/active_model_helper.rb +8 -8
  15. data/lib/action_view/helpers/asset_tag_helper.rb +62 -36
  16. data/lib/action_view/helpers/asset_url_helper.rb +111 -49
  17. data/lib/action_view/helpers/atom_feed_helper.rb +12 -13
  18. data/lib/action_view/helpers/cache_helper.rb +34 -20
  19. data/lib/action_view/helpers/capture_helper.rb +2 -2
  20. data/lib/action_view/helpers/controller_helper.rb +3 -11
  21. data/lib/action_view/helpers/csrf_helper.rb +3 -3
  22. data/lib/action_view/helpers/date_helper.rb +109 -107
  23. data/lib/action_view/helpers/debug_helper.rb +2 -3
  24. data/lib/action_view/helpers/form_helper.rb +406 -31
  25. data/lib/action_view/helpers/form_options_helper.rb +12 -12
  26. data/lib/action_view/helpers/form_tag_helper.rb +19 -18
  27. data/lib/action_view/helpers/javascript_helper.rb +6 -6
  28. data/lib/action_view/helpers/number_helper.rb +48 -46
  29. data/lib/action_view/helpers/output_safety_helper.rb +8 -8
  30. data/lib/action_view/helpers/rendering_helper.rb +2 -2
  31. data/lib/action_view/helpers/sanitize_helper.rb +6 -8
  32. data/lib/action_view/helpers/tag_helper.rb +194 -77
  33. data/lib/action_view/helpers/tags/base.rb +121 -102
  34. data/lib/action_view/helpers/tags/check_box.rb +17 -17
  35. data/lib/action_view/helpers/tags/collection_check_boxes.rb +8 -8
  36. data/lib/action_view/helpers/tags/collection_helpers.rb +60 -60
  37. data/lib/action_view/helpers/tags/collection_radio_buttons.rb +2 -2
  38. data/lib/action_view/helpers/tags/collection_select.rb +2 -2
  39. data/lib/action_view/helpers/tags/date_select.rb +36 -36
  40. data/lib/action_view/helpers/tags/grouped_collection_select.rb +2 -2
  41. data/lib/action_view/helpers/tags/label.rb +4 -0
  42. data/lib/action_view/helpers/tags/password_field.rb +1 -1
  43. data/lib/action_view/helpers/tags/radio_button.rb +4 -4
  44. data/lib/action_view/helpers/tags/select.rb +9 -9
  45. data/lib/action_view/helpers/tags/text_area.rb +1 -1
  46. data/lib/action_view/helpers/tags/text_field.rb +5 -5
  47. data/lib/action_view/helpers/tags/translator.rb +14 -12
  48. data/lib/action_view/helpers/text_helper.rb +20 -19
  49. data/lib/action_view/helpers/translation_helper.rb +6 -6
  50. data/lib/action_view/helpers/url_helper.rb +42 -38
  51. data/lib/action_view/layouts.rb +51 -47
  52. data/lib/action_view/log_subscriber.rb +24 -9
  53. data/lib/action_view/lookup_context.rb +19 -25
  54. data/lib/action_view/path_set.rb +19 -19
  55. data/lib/action_view/railtie.rb +3 -3
  56. data/lib/action_view/record_identifier.rb +6 -6
  57. data/lib/action_view/renderer/abstract_renderer.rb +17 -17
  58. data/lib/action_view/renderer/partial_renderer.rb +188 -187
  59. data/lib/action_view/renderer/partial_renderer/collection_caching.rb +7 -1
  60. data/lib/action_view/renderer/streaming_template_renderer.rb +45 -47
  61. data/lib/action_view/renderer/template_renderer.rb +64 -66
  62. data/lib/action_view/rendering.rb +4 -5
  63. data/lib/action_view/routing_url_for.rb +9 -13
  64. data/lib/action_view/tasks/cache_digests.rake +7 -7
  65. data/lib/action_view/template.rb +26 -27
  66. data/lib/action_view/template/error.rb +5 -15
  67. data/lib/action_view/template/handlers.rb +4 -4
  68. data/lib/action_view/template/handlers/builder.rb +7 -7
  69. data/lib/action_view/template/handlers/erb.rb +9 -76
  70. data/lib/action_view/template/handlers/erb/deprecated_erubis.rb +9 -0
  71. data/lib/action_view/template/handlers/erb/erubi.rb +81 -0
  72. data/lib/action_view/template/handlers/erb/erubis.rb +81 -0
  73. data/lib/action_view/template/html.rb +2 -4
  74. data/lib/action_view/template/resolver.rb +107 -90
  75. data/lib/action_view/template/text.rb +5 -8
  76. data/lib/action_view/template/types.rb +1 -1
  77. data/lib/action_view/test_case.rb +20 -21
  78. data/lib/action_view/testing/resolvers.rb +29 -30
  79. data/lib/action_view/version.rb +1 -1
  80. data/lib/action_view/view_paths.rb +20 -8
  81. data/lib/assets/compiled/rails-ujs.js +648 -0
  82. metadata +19 -14
@@ -1,5 +1,5 @@
1
- require 'active_support/core_ext/module'
2
- require 'action_view/model_naming'
1
+ require "active_support/core_ext/module"
2
+ require "action_view/model_naming"
3
3
 
4
4
  module ActionView
5
5
  # RecordIdentifier encapsulates methods used by various ActionView helpers
@@ -57,8 +57,8 @@ module ActionView
57
57
 
58
58
  include ModelNaming
59
59
 
60
- JOIN = '_'.freeze
61
- NEW = 'new'.freeze
60
+ JOIN = "_".freeze
61
+ NEW = "new".freeze
62
62
 
63
63
  # The DOM class convention is to use the singular form of an object or class.
64
64
  #
@@ -92,7 +92,7 @@ module ActionView
92
92
  end
93
93
  end
94
94
 
95
- protected
95
+ private
96
96
 
97
97
  # Returns a string representation of the key attribute(s) that is suitable for use in an HTML DOM id.
98
98
  # This can be overwritten to customize the default generated string representation if desired.
@@ -102,7 +102,7 @@ module ActionView
102
102
  # overwritten version of the method. By default, this implementation passes the key string through a
103
103
  # method that replaces all characters that are invalid inside DOM ids, with valid ones. You need to
104
104
  # make sure yourself that your dom ids are valid, in case you overwrite this method.
105
- def record_key_for_dom_id(record)
105
+ def record_key_for_dom_id(record) # :doc:
106
106
  key = convert_to_model(record).to_key
107
107
  key ? key.join(JOIN) : key
108
108
  end
@@ -15,7 +15,7 @@ module ActionView
15
15
  # that new object is called in turn. This abstracts the setup and rendering
16
16
  # into a separate classes for partials and templates.
17
17
  class AbstractRenderer #:nodoc:
18
- delegate :find_template, :find_file, :template_exists?, :any_templates?, :with_fallbacks, :with_layout_format, :formats, :to => :@lookup_context
18
+ delegate :find_template, :find_file, :template_exists?, :any_templates?, :with_fallbacks, :with_layout_format, :formats, to: :@lookup_context
19
19
 
20
20
  def initialize(lookup_context)
21
21
  @lookup_context = lookup_context
@@ -25,29 +25,29 @@ module ActionView
25
25
  raise NotImplementedError
26
26
  end
27
27
 
28
- protected
28
+ private
29
29
 
30
- def extract_details(options)
31
- @lookup_context.registered_details.each_with_object({}) do |key, details|
32
- value = options[key]
30
+ def extract_details(options) # :doc:
31
+ @lookup_context.registered_details.each_with_object({}) do |key, details|
32
+ value = options[key]
33
33
 
34
- details[key] = Array(value) if value
34
+ details[key] = Array(value) if value
35
+ end
35
36
  end
36
- end
37
37
 
38
- def instrument(name, **options)
39
- options[:identifier] ||= (@template && @template.identifier) || @path
38
+ def instrument(name, **options) # :doc:
39
+ options[:identifier] ||= (@template && @template.identifier) || @path
40
40
 
41
- ActiveSupport::Notifications.instrument("render_#{name}.action_view", options) do |payload|
42
- yield payload
41
+ ActiveSupport::Notifications.instrument("render_#{name}.action_view", options) do |payload|
42
+ yield payload
43
+ end
43
44
  end
44
- end
45
45
 
46
- def prepend_formats(formats)
47
- formats = Array(formats)
48
- return if formats.empty? || @lookup_context.html_fallback_for_js
46
+ def prepend_formats(formats) # :doc:
47
+ formats = Array(formats)
48
+ return if formats.empty? || @lookup_context.html_fallback_for_js
49
49
 
50
- @lookup_context.formats = formats | @lookup_context.formats
51
- end
50
+ @lookup_context.formats = formats | @lookup_context.formats
51
+ end
52
52
  end
53
53
  end
@@ -1,5 +1,5 @@
1
- require 'action_view/renderer/partial_renderer/collection_caching'
2
- require 'concurrent/map'
1
+ require "concurrent/map"
2
+ require "action_view/renderer/partial_renderer/collection_caching"
3
3
 
4
4
  module ActionView
5
5
  class PartialIteration
@@ -98,8 +98,8 @@ module ActionView
98
98
  #
99
99
  # <%= render partial: "ad", collection: @advertisements, spacer_template: "ad_divider" %>
100
100
  #
101
- # If the given <tt>:collection</tt> is nil or empty, <tt>render</tt> will return nil. This will allow you
102
- # to specify a text which will displayed instead by using this form:
101
+ # If the given <tt>:collection</tt> is +nil+ or empty, <tt>render</tt> will return nil. This will allow you
102
+ # to specify a text which will be displayed instead by using this form:
103
103
  #
104
104
  # <%= render(partial: "ad", collection: @advertisements) || "There's no ad to be displayed" %>
105
105
  #
@@ -307,243 +307,244 @@ module ActionView
307
307
  if @collection
308
308
  render_collection
309
309
  else
310
- instrument(:partial) do
311
- render_partial
312
- end
310
+ render_partial
313
311
  end
314
312
  end
315
313
 
316
314
  private
317
315
 
318
- def render_collection
319
- instrument(:collection, count: @collection.size) do |payload|
320
- return nil if @collection.blank?
316
+ def render_collection
317
+ instrument(:collection, count: @collection.size) do |payload|
318
+ return nil if @collection.blank?
321
319
 
322
- if @options.key?(:spacer_template)
323
- spacer = find_template(@options[:spacer_template], @locals.keys).render(@view, @locals)
324
- end
320
+ if @options.key?(:spacer_template)
321
+ spacer = find_template(@options[:spacer_template], @locals.keys).render(@view, @locals)
322
+ end
325
323
 
326
- cache_collection_render(payload) do
327
- @template ? collection_with_template : collection_without_template
328
- end.join(spacer).html_safe
324
+ cache_collection_render(payload) do
325
+ @template ? collection_with_template : collection_without_template
326
+ end.join(spacer).html_safe
327
+ end
329
328
  end
330
- end
331
329
 
332
- def render_partial
333
- view, locals, block = @view, @locals, @block
334
- object, as = @object, @variable
330
+ def render_partial
331
+ instrument(:partial) do |payload|
332
+ view, locals, block = @view, @locals, @block
333
+ object, as = @object, @variable
335
334
 
336
- if !block && (layout = @options[:layout])
337
- layout = find_template(layout.to_s, @template_keys)
338
- end
335
+ if !block && (layout = @options[:layout])
336
+ layout = find_template(layout.to_s, @template_keys)
337
+ end
338
+
339
+ object = locals[as] if object.nil? # Respect object when object is false
340
+ locals[as] = object if @has_object
339
341
 
340
- object = locals[as] if object.nil? # Respect object when object is false
341
- locals[as] = object if @has_object
342
+ content = @template.render(view, locals) do |*name|
343
+ view._layout_for(*name, &block)
344
+ end
342
345
 
343
- content = @template.render(view, locals) do |*name|
344
- view._layout_for(*name, &block)
346
+ content = layout.render(view, locals) { content } if layout
347
+ payload[:cache_hit] = view.cache_hit
348
+ content
349
+ end
345
350
  end
346
351
 
347
- content = layout.render(view, locals){ content } if layout
348
- content
349
- end
352
+ # Sets up instance variables needed for rendering a partial. This method
353
+ # finds the options and details and extracts them. The method also contains
354
+ # logic that handles the type of object passed in as the partial.
355
+ #
356
+ # If +options[:partial]+ is a string, then the +@path+ instance variable is
357
+ # set to that string. Otherwise, the +options[:partial]+ object must
358
+ # respond to +to_partial_path+ in order to setup the path.
359
+ def setup(context, options, block)
360
+ @view = context
361
+ @options = options
362
+ @block = block
363
+
364
+ @locals = options[:locals] || {}
365
+ @details = extract_details(options)
366
+
367
+ prepend_formats(options[:formats])
368
+
369
+ partial = options[:partial]
370
+
371
+ if String === partial
372
+ @has_object = options.key?(:object)
373
+ @object = options[:object]
374
+ @collection = collection_from_options
375
+ @path = partial
376
+ else
377
+ @has_object = true
378
+ @object = partial
379
+ @collection = collection_from_object || collection_from_options
380
+
381
+ if @collection
382
+ paths = @collection_data = @collection.map { |o| partial_path(o) }
383
+ @path = paths.uniq.one? ? paths.first : nil
384
+ else
385
+ @path = partial_path
386
+ end
387
+ end
350
388
 
351
- # Sets up instance variables needed for rendering a partial. This method
352
- # finds the options and details and extracts them. The method also contains
353
- # logic that handles the type of object passed in as the partial.
354
- #
355
- # If +options[:partial]+ is a string, then the +@path+ instance variable is
356
- # set to that string. Otherwise, the +options[:partial]+ object must
357
- # respond to +to_partial_path+ in order to setup the path.
358
- def setup(context, options, block)
359
- @view = context
360
- @options = options
361
- @block = block
362
-
363
- @locals = options[:locals] || {}
364
- @details = extract_details(options)
365
-
366
- prepend_formats(options[:formats])
367
-
368
- partial = options[:partial]
369
-
370
- if String === partial
371
- @has_object = options.key?(:object)
372
- @object = options[:object]
373
- @collection = collection_from_options
374
- @path = partial
375
- else
376
- @has_object = true
377
- @object = partial
378
- @collection = collection_from_object || collection_from_options
389
+ if as = options[:as]
390
+ raise_invalid_option_as(as) unless /\A[a-z_]\w*\z/.match?(as.to_s)
391
+ as = as.to_sym
392
+ end
379
393
 
380
- if @collection
381
- paths = @collection_data = @collection.map { |o| partial_path(o) }
382
- @path = paths.uniq.one? ? paths.first : nil
394
+ if @path
395
+ @variable, @variable_counter, @variable_iteration = retrieve_variable(@path, as)
396
+ @template_keys = retrieve_template_keys
383
397
  else
384
- @path = partial_path
398
+ paths.map! { |path| retrieve_variable(path, as).unshift(path) }
385
399
  end
386
- end
387
400
 
388
- if as = options[:as]
389
- raise_invalid_option_as(as) unless as.to_s =~ /\A[a-z_]\w*\z/
390
- as = as.to_sym
401
+ self
391
402
  end
392
403
 
393
- if @path
394
- @variable, @variable_counter, @variable_iteration = retrieve_variable(@path, as)
395
- @template_keys = retrieve_template_keys
396
- else
397
- paths.map! { |path| retrieve_variable(path, as).unshift(path) }
404
+ def collection_from_options
405
+ if @options.key?(:collection)
406
+ collection = @options[:collection]
407
+ collection ? collection.to_a : []
408
+ end
398
409
  end
399
410
 
400
- self
401
- end
402
-
403
- def collection_from_options
404
- if @options.key?(:collection)
405
- collection = @options[:collection]
406
- collection ? collection.to_a : []
411
+ def collection_from_object
412
+ @object.to_ary if @object.respond_to?(:to_ary)
407
413
  end
408
- end
409
414
 
410
- def collection_from_object
411
- @object.to_ary if @object.respond_to?(:to_ary)
412
- end
413
-
414
- def find_partial
415
- find_template(@path, @template_keys) if @path
416
- end
415
+ def find_partial
416
+ find_template(@path, @template_keys) if @path
417
+ end
417
418
 
418
- def find_template(path, locals)
419
- prefixes = path.include?(?/) ? [] : @lookup_context.prefixes
420
- @lookup_context.find_template(path, prefixes, true, locals, @details)
421
- end
419
+ def find_template(path, locals)
420
+ prefixes = path.include?(?/) ? [] : @lookup_context.prefixes
421
+ @lookup_context.find_template(path, prefixes, true, locals, @details)
422
+ end
422
423
 
423
- def collection_with_template
424
- view, locals, template = @view, @locals, @template
425
- as, counter, iteration = @variable, @variable_counter, @variable_iteration
424
+ def collection_with_template
425
+ view, locals, template = @view, @locals, @template
426
+ as, counter, iteration = @variable, @variable_counter, @variable_iteration
426
427
 
427
- if layout = @options[:layout]
428
- layout = find_template(layout, @template_keys)
429
- end
428
+ if layout = @options[:layout]
429
+ layout = find_template(layout, @template_keys)
430
+ end
430
431
 
431
- partial_iteration = PartialIteration.new(@collection.size)
432
- locals[iteration] = partial_iteration
432
+ partial_iteration = PartialIteration.new(@collection.size)
433
+ locals[iteration] = partial_iteration
433
434
 
434
- @collection.map do |object|
435
- locals[as] = object
436
- locals[counter] = partial_iteration.index
435
+ @collection.map do |object|
436
+ locals[as] = object
437
+ locals[counter] = partial_iteration.index
437
438
 
438
- content = template.render(view, locals)
439
- content = layout.render(view, locals) { content } if layout
440
- partial_iteration.iterate!
441
- content
439
+ content = template.render(view, locals)
440
+ content = layout.render(view, locals) { content } if layout
441
+ partial_iteration.iterate!
442
+ content
443
+ end
442
444
  end
443
- end
444
445
 
445
- def collection_without_template
446
- view, locals, collection_data = @view, @locals, @collection_data
447
- cache = {}
448
- keys = @locals.keys
446
+ def collection_without_template
447
+ view, locals, collection_data = @view, @locals, @collection_data
448
+ cache = {}
449
+ keys = @locals.keys
449
450
 
450
- partial_iteration = PartialIteration.new(@collection.size)
451
+ partial_iteration = PartialIteration.new(@collection.size)
451
452
 
452
- @collection.map do |object|
453
- index = partial_iteration.index
454
- path, as, counter, iteration = collection_data[index]
453
+ @collection.map do |object|
454
+ index = partial_iteration.index
455
+ path, as, counter, iteration = collection_data[index]
455
456
 
456
- locals[as] = object
457
- locals[counter] = index
458
- locals[iteration] = partial_iteration
457
+ locals[as] = object
458
+ locals[counter] = index
459
+ locals[iteration] = partial_iteration
459
460
 
460
- template = (cache[path] ||= find_template(path, keys + [as, counter, iteration]))
461
- content = template.render(view, locals)
462
- partial_iteration.iterate!
463
- content
461
+ template = (cache[path] ||= find_template(path, keys + [as, counter, iteration]))
462
+ content = template.render(view, locals)
463
+ partial_iteration.iterate!
464
+ content
465
+ end
464
466
  end
465
- end
466
467
 
467
- # Obtains the path to where the object's partial is located. If the object
468
- # responds to +to_partial_path+, then +to_partial_path+ will be called and
469
- # will provide the path. If the object does not respond to +to_partial_path+,
470
- # then an +ArgumentError+ is raised.
471
- #
472
- # If +prefix_partial_path_with_controller_namespace+ is true, then this
473
- # method will prefix the partial paths with a namespace.
474
- def partial_path(object = @object)
475
- object = object.to_model if object.respond_to?(:to_model)
476
-
477
- path = if object.respond_to?(:to_partial_path)
478
- object.to_partial_path
479
- else
480
- raise ArgumentError.new("'#{object.inspect}' is not an ActiveModel-compatible object. It must implement :to_partial_path.")
468
+ # Obtains the path to where the object's partial is located. If the object
469
+ # responds to +to_partial_path+, then +to_partial_path+ will be called and
470
+ # will provide the path. If the object does not respond to +to_partial_path+,
471
+ # then an +ArgumentError+ is raised.
472
+ #
473
+ # If +prefix_partial_path_with_controller_namespace+ is true, then this
474
+ # method will prefix the partial paths with a namespace.
475
+ def partial_path(object = @object)
476
+ object = object.to_model if object.respond_to?(:to_model)
477
+
478
+ path = if object.respond_to?(:to_partial_path)
479
+ object.to_partial_path
480
+ else
481
+ raise ArgumentError.new("'#{object.inspect}' is not an ActiveModel-compatible object. It must implement :to_partial_path.")
482
+ end
483
+
484
+ if @view.prefix_partial_path_with_controller_namespace
485
+ prefixed_partial_names[path] ||= merge_prefix_into_object_path(@context_prefix, path.dup)
486
+ else
487
+ path
488
+ end
481
489
  end
482
490
 
483
- if @view.prefix_partial_path_with_controller_namespace
484
- prefixed_partial_names[path] ||= merge_prefix_into_object_path(@context_prefix, path.dup)
485
- else
486
- path
491
+ def prefixed_partial_names
492
+ @prefixed_partial_names ||= PREFIXED_PARTIAL_NAMES[@context_prefix]
487
493
  end
488
- end
489
494
 
490
- def prefixed_partial_names
491
- @prefixed_partial_names ||= PREFIXED_PARTIAL_NAMES[@context_prefix]
492
- end
495
+ def merge_prefix_into_object_path(prefix, object_path)
496
+ if prefix.include?(?/) && object_path.include?(?/)
497
+ prefixes = []
498
+ prefix_array = File.dirname(prefix).split("/")
499
+ object_path_array = object_path.split("/")[0..-3] # skip model dir & partial
493
500
 
494
- def merge_prefix_into_object_path(prefix, object_path)
495
- if prefix.include?(?/) && object_path.include?(?/)
496
- prefixes = []
497
- prefix_array = File.dirname(prefix).split('/')
498
- object_path_array = object_path.split('/')[0..-3] # skip model dir & partial
501
+ prefix_array.each_with_index do |dir, index|
502
+ break if dir == object_path_array[index]
503
+ prefixes << dir
504
+ end
499
505
 
500
- prefix_array.each_with_index do |dir, index|
501
- break if dir == object_path_array[index]
502
- prefixes << dir
506
+ (prefixes << object_path).join("/")
507
+ else
508
+ object_path
503
509
  end
504
-
505
- (prefixes << object_path).join("/")
506
- else
507
- object_path
508
510
  end
509
- end
510
511
 
511
- def retrieve_template_keys
512
- keys = @locals.keys
513
- keys << @variable if @has_object || @collection
514
- if @collection
515
- keys << @variable_counter
516
- keys << @variable_iteration
512
+ def retrieve_template_keys
513
+ keys = @locals.keys
514
+ keys << @variable if @has_object || @collection
515
+ if @collection
516
+ keys << @variable_counter
517
+ keys << @variable_iteration
518
+ end
519
+ keys
517
520
  end
518
- keys
519
- end
520
521
 
521
- def retrieve_variable(path, as)
522
- variable = as || begin
523
- base = path[-1] == "/".freeze ? "".freeze : File.basename(path)
524
- raise_invalid_identifier(path) unless base =~ /\A_?(.*?)(?:\.\w+)*\z/
525
- $1.to_sym
526
- end
527
- if @collection
528
- variable_counter = :"#{variable}_counter"
529
- variable_iteration = :"#{variable}_iteration"
522
+ def retrieve_variable(path, as)
523
+ variable = as || begin
524
+ base = path[-1] == "/".freeze ? "".freeze : File.basename(path)
525
+ raise_invalid_identifier(path) unless base =~ /\A_?(.*?)(?:\.\w+)*\z/
526
+ $1.to_sym
527
+ end
528
+ if @collection
529
+ variable_counter = :"#{variable}_counter"
530
+ variable_iteration = :"#{variable}_iteration"
531
+ end
532
+ [variable, variable_counter, variable_iteration]
530
533
  end
531
- [variable, variable_counter, variable_iteration]
532
- end
533
534
 
534
- IDENTIFIER_ERROR_MESSAGE = "The partial name (%s) is not a valid Ruby identifier; " +
535
- "make sure your partial name starts with underscore."
535
+ IDENTIFIER_ERROR_MESSAGE = "The partial name (%s) is not a valid Ruby identifier; " \
536
+ "make sure your partial name starts with underscore."
536
537
 
537
- OPTION_AS_ERROR_MESSAGE = "The value (%s) of the option `as` is not a valid Ruby identifier; " +
538
- "make sure it starts with lowercase letter, " +
539
- "and is followed by any combination of letters, numbers and underscores."
538
+ OPTION_AS_ERROR_MESSAGE = "The value (%s) of the option `as` is not a valid Ruby identifier; " \
539
+ "make sure it starts with lowercase letter, " \
540
+ "and is followed by any combination of letters, numbers and underscores."
540
541
 
541
- def raise_invalid_identifier(path)
542
- raise ArgumentError.new(IDENTIFIER_ERROR_MESSAGE % (path))
543
- end
542
+ def raise_invalid_identifier(path)
543
+ raise ArgumentError.new(IDENTIFIER_ERROR_MESSAGE % (path))
544
+ end
544
545
 
545
- def raise_invalid_option_as(as)
546
- raise ArgumentError.new(OPTION_AS_ERROR_MESSAGE % (as))
547
- end
546
+ def raise_invalid_option_as(as)
547
+ raise ArgumentError.new(OPTION_AS_ERROR_MESSAGE % (as))
548
+ end
548
549
  end
549
550
  end