nanoc 3.7.3 → 3.7.4

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 (182) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +71 -46
  3. data/NEWS.md +14 -0
  4. data/lib/nanoc.rb +1 -1
  5. data/lib/nanoc/base/checksummer.rb +1 -1
  6. data/lib/nanoc/base/compilation/checksum_store.rb +1 -1
  7. data/lib/nanoc/base/compilation/compiled_content_cache.rb +1 -1
  8. data/lib/nanoc/base/compilation/compiler.rb +11 -10
  9. data/lib/nanoc/base/compilation/compiler_dsl.rb +4 -4
  10. data/lib/nanoc/base/compilation/dependency_tracker.rb +7 -7
  11. data/lib/nanoc/base/compilation/filter.rb +1 -1
  12. data/lib/nanoc/base/compilation/item_rep_proxy.rb +6 -5
  13. data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +8 -7
  14. data/lib/nanoc/base/compilation/outdatedness_checker.rb +6 -6
  15. data/lib/nanoc/base/compilation/rule.rb +1 -1
  16. data/lib/nanoc/base/compilation/rule_memory_store.rb +1 -1
  17. data/lib/nanoc/base/compilation/rules_collection.rb +5 -5
  18. data/lib/nanoc/base/context.rb +1 -1
  19. data/lib/nanoc/base/core_ext/array.rb +1 -1
  20. data/lib/nanoc/base/core_ext/date.rb +1 -1
  21. data/lib/nanoc/base/core_ext/hash.rb +1 -1
  22. data/lib/nanoc/base/directed_graph.rb +3 -3
  23. data/lib/nanoc/base/memoization.rb +1 -1
  24. data/lib/nanoc/base/notification_center.rb +1 -1
  25. data/lib/nanoc/base/ordered_hash.rb +1 -1
  26. data/lib/nanoc/base/plugin_registry.rb +3 -3
  27. data/lib/nanoc/base/result_data/item_rep.rb +13 -11
  28. data/lib/nanoc/base/source_data/code_snippet.rb +2 -2
  29. data/lib/nanoc/base/source_data/data_source.rb +3 -3
  30. data/lib/nanoc/base/source_data/item.rb +8 -8
  31. data/lib/nanoc/base/source_data/item_array.rb +1 -1
  32. data/lib/nanoc/base/source_data/layout.rb +1 -1
  33. data/lib/nanoc/base/source_data/site.rb +27 -18
  34. data/lib/nanoc/base/store.rb +3 -3
  35. data/lib/nanoc/base/temp_filename_factory.rb +2 -2
  36. data/lib/nanoc/cli.rb +6 -6
  37. data/lib/nanoc/cli/cleaning_stream.rb +1 -1
  38. data/lib/nanoc/cli/command_runner.rb +4 -3
  39. data/lib/nanoc/cli/commands/autocompile.rb +3 -3
  40. data/lib/nanoc/cli/commands/check.rb +3 -3
  41. data/lib/nanoc/cli/commands/compile.rb +23 -23
  42. data/lib/nanoc/cli/commands/create-item.rb +5 -5
  43. data/lib/nanoc/cli/commands/create-layout.rb +14 -14
  44. data/lib/nanoc/cli/commands/create-site.rb +6 -6
  45. data/lib/nanoc/cli/commands/deploy.rb +8 -8
  46. data/lib/nanoc/cli/commands/nanoc.rb +3 -3
  47. data/lib/nanoc/cli/commands/prune.rb +3 -3
  48. data/lib/nanoc/cli/commands/shell.rb +4 -4
  49. data/lib/nanoc/cli/commands/show-data.rb +5 -5
  50. data/lib/nanoc/cli/commands/show-plugins.rb +5 -5
  51. data/lib/nanoc/cli/commands/show-rules.rb +4 -4
  52. data/lib/nanoc/cli/commands/sync.rb +1 -1
  53. data/lib/nanoc/cli/commands/update.rb +13 -13
  54. data/lib/nanoc/cli/commands/validate-css.rb +3 -3
  55. data/lib/nanoc/cli/commands/validate-html.rb +3 -3
  56. data/lib/nanoc/cli/commands/validate-links.rb +6 -6
  57. data/lib/nanoc/cli/commands/view.rb +4 -4
  58. data/lib/nanoc/cli/commands/watch.rb +11 -11
  59. data/lib/nanoc/cli/error_handler.rb +10 -10
  60. data/lib/nanoc/cli/logger.rb +1 -1
  61. data/lib/nanoc/cli/stream_cleaners/abstract.rb +1 -1
  62. data/lib/nanoc/data_sources/deprecated/last_fm.rb +5 -5
  63. data/lib/nanoc/data_sources/deprecated/twitter.rb +1 -1
  64. data/lib/nanoc/data_sources/filesystem.rb +16 -16
  65. data/lib/nanoc/data_sources/filesystem_unified.rb +1 -1
  66. data/lib/nanoc/data_sources/filesystem_verbose.rb +1 -1
  67. data/lib/nanoc/data_sources/static.rb +1 -1
  68. data/lib/nanoc/extra/auto_compiler.rb +2 -2
  69. data/lib/nanoc/extra/checking/check.rb +11 -1
  70. data/lib/nanoc/extra/checking/checks/external_links.rb +15 -7
  71. data/lib/nanoc/extra/checking/checks/internal_links.rb +3 -3
  72. data/lib/nanoc/extra/checking/checks/stale.rb +6 -6
  73. data/lib/nanoc/extra/checking/runner.rb +10 -9
  74. data/lib/nanoc/extra/chick.rb +2 -2
  75. data/lib/nanoc/extra/core_ext/enumerable.rb +1 -1
  76. data/lib/nanoc/extra/deployers/fog.rb +2 -2
  77. data/lib/nanoc/extra/deployers/rsync.rb +3 -3
  78. data/lib/nanoc/extra/file_proxy.rb +3 -3
  79. data/lib/nanoc/extra/jruby_nokogiri_warner.rb +1 -1
  80. data/lib/nanoc/extra/link_collector.rb +3 -3
  81. data/lib/nanoc/extra/piper.rb +2 -2
  82. data/lib/nanoc/extra/pruner.rb +4 -3
  83. data/lib/nanoc/extra/validators/links.rb +2 -2
  84. data/lib/nanoc/extra/validators/w3c.rb +1 -1
  85. data/lib/nanoc/extra/vcs.rb +5 -5
  86. data/lib/nanoc/extra/vcses/dummy.rb +1 -1
  87. data/lib/nanoc/filters/asciidoc.rb +1 -1
  88. data/lib/nanoc/filters/bluecloth.rb +1 -1
  89. data/lib/nanoc/filters/coffeescript.rb +1 -1
  90. data/lib/nanoc/filters/colorize_syntax.rb +19 -21
  91. data/lib/nanoc/filters/erubis.rb +1 -1
  92. data/lib/nanoc/filters/handlebars.rb +1 -1
  93. data/lib/nanoc/filters/less.rb +2 -2
  94. data/lib/nanoc/filters/markaby.rb +1 -1
  95. data/lib/nanoc/filters/mustache.rb +1 -1
  96. data/lib/nanoc/filters/rdoc.rb +1 -1
  97. data/lib/nanoc/filters/relativize_paths.rb +5 -5
  98. data/lib/nanoc/filters/rubypants.rb +1 -1
  99. data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +1 -1
  100. data/lib/nanoc/filters/typogruby.rb +1 -1
  101. data/lib/nanoc/filters/xsl.rb +1 -1
  102. data/lib/nanoc/helpers/blogging.rb +12 -12
  103. data/lib/nanoc/helpers/capturing.rb +3 -3
  104. data/lib/nanoc/helpers/html_escape.rb +6 -6
  105. data/lib/nanoc/helpers/tagging.rb +1 -1
  106. data/lib/nanoc/helpers/xml_sitemap.rb +4 -4
  107. data/lib/nanoc/tasks/clean.rake +1 -1
  108. data/lib/nanoc/tasks/clean.rb +1 -1
  109. data/lib/nanoc/tasks/deploy/rsync.rake +2 -2
  110. data/lib/nanoc/version.rb +1 -1
  111. data/tasks/rubocop.rake +1 -0
  112. data/test/base/core_ext/array_spec.rb +7 -7
  113. data/test/base/core_ext/hash_spec.rb +1 -1
  114. data/test/base/test_checksum_store.rb +1 -1
  115. data/test/base/test_compiler.rb +14 -14
  116. data/test/base/test_compiler_dsl.rb +13 -13
  117. data/test/base/test_context.rb +2 -2
  118. data/test/base/test_dependency_tracker.rb +42 -42
  119. data/test/base/test_directed_graph.rb +102 -102
  120. data/test/base/test_item.rb +21 -21
  121. data/test/base/test_item_array.rb +19 -19
  122. data/test/base/test_item_rep.rb +50 -50
  123. data/test/base/test_layout.rb +6 -6
  124. data/test/base/test_outdatedness_checker.rb +2 -2
  125. data/test/base/test_rule_context.rb +2 -2
  126. data/test/base/test_site.rb +5 -5
  127. data/test/cli/commands/test_compile.rb +7 -7
  128. data/test/cli/commands/test_create_site.rb +2 -2
  129. data/test/cli/commands/test_deploy.rb +10 -10
  130. data/test/cli/commands/test_prune.rb +2 -2
  131. data/test/cli/commands/test_sync.rb +1 -1
  132. data/test/cli/commands/test_watch.rb +7 -7
  133. data/test/cli/test_cleaning_stream.rb +4 -4
  134. data/test/cli/test_cli.rb +3 -3
  135. data/test/cli/test_error_handler.rb +3 -3
  136. data/test/data_sources/test_filesystem.rb +19 -19
  137. data/test/data_sources/test_filesystem_unified.rb +30 -30
  138. data/test/data_sources/test_filesystem_verbose.rb +3 -3
  139. data/test/data_sources/test_static.rb +9 -9
  140. data/test/extra/checking/checks/test_stale.rb +8 -8
  141. data/test/extra/checking/test_check.rb +11 -1
  142. data/test/extra/checking/test_dsl.rb +1 -1
  143. data/test/extra/core_ext/test_enumerable.rb +2 -2
  144. data/test/extra/deployers/test_fog.rb +10 -10
  145. data/test/extra/deployers/test_rsync.rb +2 -2
  146. data/test/extra/test_auto_compiler.rb +28 -28
  147. data/test/extra/test_filesystem_tools.rb +3 -3
  148. data/test/extra/test_link_collector.rb +39 -20
  149. data/test/extra/validators/test_w3c.rb +5 -5
  150. data/test/filters/test_asciidoc.rb +2 -2
  151. data/test/filters/test_bluecloth.rb +1 -1
  152. data/test/filters/test_coffeescript.rb +1 -1
  153. data/test/filters/test_colorize_syntax.rb +20 -13
  154. data/test/filters/test_erb.rb +1 -1
  155. data/test/filters/test_kramdown.rb +1 -1
  156. data/test/filters/test_less.rb +10 -10
  157. data/test/filters/test_markaby.rb +2 -2
  158. data/test/filters/test_maruku.rb +2 -2
  159. data/test/filters/test_pandoc.rb +3 -3
  160. data/test/filters/test_rainpress.rb +4 -4
  161. data/test/filters/test_rdiscount.rb +2 -2
  162. data/test/filters/test_rdoc.rb +1 -1
  163. data/test/filters/test_redcarpet.rb +5 -5
  164. data/test/filters/test_redcloth.rb +5 -5
  165. data/test/filters/test_relativize_paths.rb +33 -31
  166. data/test/filters/test_rubypants.rb +2 -2
  167. data/test/filters/test_sass.rb +8 -8
  168. data/test/filters/test_slim.rb +3 -3
  169. data/test/filters/test_uglify_js.rb +1 -1
  170. data/test/filters/test_yui_compressor.rb +3 -3
  171. data/test/gem_loader.rb +1 -1
  172. data/test/helper.rb +14 -16
  173. data/test/helpers/test_blogging.rb +28 -28
  174. data/test/helpers/test_breadcrumbs.rb +12 -12
  175. data/test/helpers/test_capturing.rb +7 -7
  176. data/test/helpers/test_filtering.rb +16 -16
  177. data/test/helpers/test_link_to.rb +3 -3
  178. data/test/helpers/test_rendering.rb +1 -1
  179. data/test/helpers/test_tagging.rb +11 -11
  180. data/test/helpers/test_xml_sitemap.rb +18 -18
  181. data/test/tasks/test_clean.rb +8 -8
  182. metadata +2 -2
@@ -14,7 +14,7 @@ module Nanoc
14
14
  extend Forwardable
15
15
 
16
16
  def_delegators :@item_rep, :item, :name, :binary, :binary?, :compiled_content, :has_snapshot?, :raw_path, :path
17
- def_delegator :@item_rep, :snapshot
17
+ def_delegator :@item_rep, :snapshot
18
18
 
19
19
  # @param [Nanoc::ItemRep] item_rep The item representation that this
20
20
  # proxy should behave like
@@ -76,13 +76,14 @@ module Nanoc
76
76
  #
77
77
  # @return [true]
78
78
  #
79
- # @see Nanoc::ItemRep#is_proxy?
80
- # @see Nanoc::ItemRepRecorderProxy#is_proxy?
81
- def is_proxy?
79
+ # @see Nanoc::ItemRep#proxy?
80
+ # @see Nanoc::ItemRepRecorderProxy#proxy?
81
+ def proxy?
82
82
  true
83
83
  end
84
+ alias_method :is_proxy?, :proxy?
84
85
 
85
- private
86
+ private
86
87
 
87
88
  def set_assigns
88
89
  @item_rep.assigns = @compiler.assigns_for(@item_rep)
@@ -50,7 +50,7 @@ module Nanoc
50
50
  #
51
51
  # @see Nanoc::ItemRepProxy#filter, Nanoc::ItemRep#filter
52
52
  def filter(name, args = {})
53
- @rule_memory << [ :filter, name, args ]
53
+ @rule_memory << [:filter, name, args]
54
54
  end
55
55
 
56
56
  # @return [void]
@@ -58,9 +58,9 @@ module Nanoc
58
58
  # @see Nanoc::ItemRepProxy#layout, Nanoc::ItemRep#layout
59
59
  def layout(layout_identifier, extra_filter_args = nil)
60
60
  if extra_filter_args
61
- @rule_memory << [ :layout, layout_identifier, extra_filter_args ]
61
+ @rule_memory << [:layout, layout_identifier, extra_filter_args]
62
62
  else
63
- @rule_memory << [ :layout, layout_identifier ]
63
+ @rule_memory << [:layout, layout_identifier]
64
64
  end
65
65
  end
66
66
 
@@ -68,7 +68,7 @@ module Nanoc
68
68
  #
69
69
  # @see Nanoc::ItemRep#snapshot
70
70
  def snapshot(snapshot_name, params = {})
71
- @rule_memory << [ :snapshot, snapshot_name, params ]
71
+ @rule_memory << [:snapshot, snapshot_name, params]
72
72
 
73
73
  # Count
74
74
  existing = Set.new
@@ -91,11 +91,12 @@ module Nanoc
91
91
  #
92
92
  # @return [true]
93
93
  #
94
- # @see Nanoc::ItemRep#is_proxy?
95
- # @see Nanoc::ItemRepProxy#is_proxy?
96
- def is_proxy?
94
+ # @see Nanoc::ItemRep#proxy?
95
+ # @see Nanoc::ItemRepProxy#proxy?
96
+ def proxy?
97
97
  true
98
98
  end
99
+ alias_method :is_proxy?, :proxy?
99
100
 
100
101
  end
101
102
 
@@ -60,7 +60,7 @@ module Nanoc
60
60
  end
61
61
  memoize :outdatedness_reason_for
62
62
 
63
- private
63
+ private
64
64
 
65
65
  # Checks whether the given object is outdated and therefore needs to be
66
66
  # recompiled. This method does not take dependencies into account; use
@@ -92,8 +92,8 @@ module Nanoc
92
92
  rule_memory_differs_for(obj)
93
93
 
94
94
  # Outdated if checksums are missing or different
95
- return Nanoc::OutdatednessReasons::NotEnoughData if !checksums_available?(obj.item)
96
- return Nanoc::OutdatednessReasons::SourceModified if !checksums_identical?(obj.item)
95
+ return Nanoc::OutdatednessReasons::NotEnoughData unless checksums_available?(obj.item)
96
+ return Nanoc::OutdatednessReasons::SourceModified unless checksums_identical?(obj.item)
97
97
 
98
98
  # Outdated if compiled file doesn't exist (yet)
99
99
  return Nanoc::OutdatednessReasons::NotWritten if obj.raw_path && !File.file?(obj.raw_path)
@@ -116,8 +116,8 @@ module Nanoc
116
116
  rule_memory_differs_for(obj)
117
117
 
118
118
  # Outdated if checksums are missing or different
119
- return Nanoc::OutdatednessReasons::NotEnoughData if !checksums_available?(obj)
120
- return Nanoc::OutdatednessReasons::SourceModified if !checksums_identical?(obj)
119
+ return Nanoc::OutdatednessReasons::NotEnoughData unless checksums_available?(obj)
120
+ return Nanoc::OutdatednessReasons::SourceModified unless checksums_identical?(obj)
121
121
 
122
122
  # Not outdated
123
123
  return nil
@@ -179,7 +179,7 @@ module Nanoc
179
179
  # @return [Boolean] false if either the new or the old checksum for the
180
180
  # given object is not available, true if both checksums are available
181
181
  def checksums_available?(obj)
182
- !!checksum_store[obj] && obj.checksum
182
+ checksum_store[obj] && obj.checksum
183
183
  end
184
184
  memoize :checksums_available?
185
185
 
@@ -66,7 +66,7 @@ module Nanoc
66
66
  compiler = params.fetch(:compiler) do
67
67
  raise ArgumentError, 'Required :compiler option is missing'
68
68
  end
69
- rep = Nanoc::ItemRepProxy.new(rep, compiler) unless rep.is_proxy?
69
+ rep = Nanoc::ItemRepProxy.new(rep, compiler) unless rep.proxy?
70
70
  Nanoc::RuleContext.new(:rep => rep, :compiler => compiler).instance_eval(&@block)
71
71
  end
72
72
 
@@ -36,7 +36,7 @@ module Nanoc
36
36
  @rule_memories[obj.reference] = rule_memory
37
37
  end
38
38
 
39
- protected
39
+ protected
40
40
 
41
41
  # @see Nanoc::Store#data
42
42
  def data
@@ -76,7 +76,7 @@ module Nanoc
76
76
  # @return [void]
77
77
  def load
78
78
  # Find rules file
79
- rules_filenames = [ 'Rules', 'rules', 'Rules.rb', 'rules.rb' ]
79
+ rules_filenames = ['Rules', 'rules', 'Rules.rb', 'rules.rb']
80
80
  rules_filename = rules_filenames.find { |f| File.file?(f) }
81
81
  raise Nanoc::Errors::NoRulesFileFound.new if rules_filename.nil?
82
82
 
@@ -141,7 +141,7 @@ module Nanoc
141
141
  def routing_rules_for(rep)
142
142
  rules = {}
143
143
  @item_routing_rules.each do |rule|
144
- next if !rule.applicable_to?(rep.item)
144
+ next unless rule.applicable_to?(rep.item)
145
145
  next if rule.rep_name != rep.name
146
146
  next if rules.key?(rule.snapshot_name)
147
147
 
@@ -193,7 +193,7 @@ module Nanoc
193
193
  def new_rule_memory_for_rep(rep)
194
194
  recording_proxy = rep.to_recording_proxy
195
195
  compilation_rule_for(rep).apply_to(recording_proxy, :compiler => @compiler)
196
- recording_proxy.rule_memory << [ :write, rep.path ]
196
+ recording_proxy.rule_memory << [:write, rep.path]
197
197
  make_rule_memory_serializable(recording_proxy.rule_memory)
198
198
  end
199
199
  memoize :new_rule_memory_for_rep
@@ -208,7 +208,7 @@ module Nanoc
208
208
  def make_rule_memory_serializable(rs)
209
209
  rs.map do |r|
210
210
  if r[0] == :filter
211
- [ r[0], r[1], r[2].to_a.map { |a| Nanoc::Checksummer.calc(a) } ]
211
+ [r[0], r[1], r[2].to_a.map { |a| Nanoc::Checksummer.calc(a) }]
212
212
  else
213
213
  r
214
214
  end
@@ -231,7 +231,7 @@ module Nanoc
231
231
  # a Boolean indicating whether the snapshot is final or not
232
232
  def snapshots_for(rep)
233
233
  new_rule_memory_for_rep(rep).select { |e| e[0] == :snapshot }.map do |e|
234
- [ e[1], e[2].fetch(:final) { true } ]
234
+ [e[1], e[2].fetch(:final) { true }]
235
235
  end
236
236
  end
237
237
 
@@ -31,7 +31,7 @@ module Nanoc
31
31
  instance_variable_set('@' + key.to_s, value)
32
32
 
33
33
  # Define method
34
- metaclass = (class << self ; self ; end)
34
+ metaclass = (class << self; self; end)
35
35
  metaclass.send(:define_method, key) { value }
36
36
  end
37
37
  end
@@ -27,7 +27,7 @@ module Nanoc::ArrayExtensions
27
27
  # @return [Array] The converted array
28
28
  def stringify_keys_recursively
29
29
  reduce([]) do |array, element|
30
- array + [ element.respond_to?(:stringify_keys_recursively) ? element.stringify_keys_recursively : element ]
30
+ array + [element.respond_to?(:stringify_keys_recursively) ? element.stringify_keys_recursively : element]
31
31
  end
32
32
  end
33
33
 
@@ -15,7 +15,7 @@ if needs_patch
15
15
 
16
16
  class ::Date
17
17
 
18
- [ :amjd, :jd, :day_fraction, :mjd, :ld, :civil, :ordinal, :commercial, :weeknum0, :weeknum1, :time, :wday, :julian?, :gregorian?, :leap? ].each do |m|
18
+ [:amjd, :jd, :day_fraction, :mjd, :ld, :civil, :ordinal, :commercial, :weeknum0, :weeknum1, :time, :wday, :julian?, :gregorian?, :leap?].each do |m|
19
19
  module_eval <<EOS
20
20
  alias_method :__orig_#{m}, :#{m}
21
21
  def #{m}
@@ -50,7 +50,7 @@ module Nanoc::HashExtensions
50
50
  def freeze_recursively
51
51
  return if self.frozen?
52
52
  freeze
53
- each_pair do |key, value|
53
+ each_pair do |_key, value|
54
54
  if value.respond_to?(:freeze_recursively)
55
55
  value.freeze_recursively
56
56
  else
@@ -211,7 +211,7 @@ module Nanoc
211
211
  result = []
212
212
  @vertices.each_pair do |v1, i1|
213
213
  direct_successors_of(v1).map { |v2| @vertices[v2] }.each do |i2|
214
- result << [ i1, i2 ]
214
+ result << [i1, i2]
215
215
  end
216
216
  end
217
217
  result
@@ -233,7 +233,7 @@ module Nanoc
233
233
  delete_edge(from, to)
234
234
  end
235
235
 
236
- private
236
+ private
237
237
 
238
238
  # Invalidates cached data. This method should be called when the internal
239
239
  # graph representation is changed.
@@ -249,7 +249,7 @@ module Nanoc
249
249
  all_vertices = Set.new
250
250
 
251
251
  processed_vertices = Set.new
252
- unprocessed_vertices = [ start ]
252
+ unprocessed_vertices = [start]
253
253
 
254
254
  until unprocessed_vertices.empty?
255
255
  # Get next unprocessed vertex
@@ -52,7 +52,7 @@ module Nanoc
52
52
  @__memoization_cache[method_name] ||= {}
53
53
 
54
54
  # Recalculate if necessary
55
- if !@__memoization_cache[method_name].key?(args)
55
+ unless @__memoization_cache[method_name].key?(args)
56
56
  result = send(original_method_name, *args)
57
57
  @__memoization_cache[method_name][args] = result
58
58
  end
@@ -70,7 +70,7 @@ module Nanoc
70
70
  @notifications[name].reject! { |i| i[:id] == id }
71
71
  end
72
72
 
73
- private
73
+ private
74
74
 
75
75
  def initialize_if_necessary(name)
76
76
  @notifications ||= {} # name => observers dictionary
@@ -206,7 +206,7 @@ class OrderedHash < ::Hash
206
206
  end
207
207
  class << self
208
208
  def to_yaml(opts = {})
209
- @__yaml_inline ? @__yaml_inline_meth[ opts ] : super
209
+ @__yaml_inline ? @__yaml_inline_meth[opts] : super
210
210
  rescue
211
211
  @to_yaml_style = :inline
212
212
  super
@@ -188,7 +188,7 @@ module Nanoc
188
188
  plugins << {
189
189
  :class => klass,
190
190
  :superclass => superclass,
191
- :identifiers => [ identifier ]
191
+ :identifiers => [identifier]
192
192
  }
193
193
  end
194
194
  end
@@ -202,9 +202,9 @@ module Nanoc
202
202
  find(self, name)
203
203
  end
204
204
 
205
- protected
205
+ protected
206
206
 
207
- def resolve(class_or_name, klass)
207
+ def resolve(class_or_name, _klass)
208
208
  if class_or_name.is_a?(String)
209
209
  class_or_name.scan(/\w+/).reduce(Kernel) do |memo, part|
210
210
  memo.const_get(part)
@@ -182,14 +182,14 @@ module Nanoc
182
182
  include Private
183
183
 
184
184
  # @return [Nanoc::Item] The item to which this rep belongs
185
- attr_reader :item
185
+ attr_reader :item
186
186
 
187
187
  # @return [Symbol] The representation's unique name
188
- attr_reader :name
188
+ attr_reader :name
189
189
 
190
190
  # @return [Boolean] true if this rep is currently binary; false otherwise
191
- attr_reader :binary
192
- alias_method :binary?, :binary
191
+ attr_reader :binary
192
+ alias_method :binary?, :binary
193
193
 
194
194
  # @return [Array] A list of snapshots, represented as arrays where the
195
195
  # first element is the snapshot name (a Symbol) and the last element is
@@ -242,7 +242,7 @@ module Nanoc
242
242
 
243
243
  # Get name of last pre-layout snapshot
244
244
  snapshot = params.fetch(:snapshot) { @content[:pre] ? :pre : :last }
245
- is_moving = [ :pre, :post, :last ].include?(snapshot)
245
+ is_moving = [:pre, :post, :last].include?(snapshot)
246
246
 
247
247
  # Check existance of snapshot
248
248
  if !is_moving && snapshots.find { |s| s.first == snapshot && s.last == true }.nil?
@@ -263,9 +263,10 @@ module Nanoc
263
263
  # given name, false otherwise
264
264
  #
265
265
  # @since 3.2.0
266
- def has_snapshot?(snapshot_name)
266
+ def snapshot?(snapshot_name)
267
267
  !@content[snapshot_name].nil?
268
268
  end
269
+ alias_method :has_snapshot?, :snapshot?
269
270
 
270
271
  # Returns the item rep’s raw path. It includes the path to the output
271
272
  # directory and the full filename.
@@ -444,11 +445,12 @@ module Nanoc
444
445
  #
445
446
  # @return [false]
446
447
  #
447
- # @see Nanoc::ItemRepRecorderProxy#is_proxy?
448
- # @see Nanoc::ItemRepProxy#is_proxy?
449
- def is_proxy?
448
+ # @see Nanoc::ItemRepRecorderProxy#proxy?
449
+ # @see Nanoc::ItemRepProxy#proxy?
450
+ def proxy?
450
451
  false
451
452
  end
453
+ alias_method :is_proxy?, :proxy?
452
454
 
453
455
  # Returns an object that can be used for uniquely identifying objects.
454
456
  #
@@ -456,14 +458,14 @@ module Nanoc
456
458
  #
457
459
  # @return [Object] An unique reference to this object
458
460
  def reference
459
- [ type, item.identifier, name ]
461
+ [type, item.identifier, name]
460
462
  end
461
463
 
462
464
  def inspect
463
465
  "<#{self.class} name=\"#{name}\" binary=#{self.binary?} raw_path=\"#{raw_path}\" item.identifier=\"#{item.identifier}\">"
464
466
  end
465
467
 
466
- private
468
+ private
467
469
 
468
470
  def initialize_content
469
471
  # Initialize content and filenames
@@ -24,7 +24,7 @@ module Nanoc
24
24
  #
25
25
  # @param [Time, Hash] params Extra parameters. Ignored by nanoc; it is
26
26
  # only included for backwards compatibility.
27
- def initialize(data, filename, params = nil)
27
+ def initialize(data, filename, _params = nil)
28
28
  @data = data
29
29
  @filename = filename
30
30
  end
@@ -40,7 +40,7 @@ module Nanoc
40
40
  #
41
41
  # @return [Object] An unique reference to this object
42
42
  def reference
43
- [ :code_snippet, filename ]
43
+ [:code_snippet, filename]
44
44
  end
45
45
 
46
46
  def inspect
@@ -207,7 +207,7 @@ module Nanoc
207
207
  # files that should be generated.
208
208
  #
209
209
  # @return [void]
210
- def create_item(content, attributes, identifier, params = {})
210
+ def create_item(_content, _attributes, _identifier, _params = {})
211
211
  not_implemented('create_item')
212
212
  end
213
213
 
@@ -230,11 +230,11 @@ module Nanoc
230
230
  # files that should be generated.
231
231
  #
232
232
  # @return [void]
233
- def create_layout(content, attributes, identifier, params = {})
233
+ def create_layout(_content, _attributes, _identifier, _params = {})
234
234
  not_implemented('create_layout')
235
235
  end
236
236
 
237
- private
237
+ private
238
238
 
239
239
  def not_implemented(name)
240
240
  raise NotImplementedError.new(
@@ -26,15 +26,15 @@ module Nanoc
26
26
  attr_accessor :identifier
27
27
 
28
28
  # @return [Array<Nanoc::ItemRep>] This item’s list of item reps
29
- attr_reader :reps
29
+ attr_reader :reps
30
30
 
31
31
  # @return [String] This item's raw, uncompiled content of this item (only
32
32
  # available for textual items)
33
- attr_reader :raw_content
33
+ attr_reader :raw_content
34
34
 
35
35
  # @return [String] The filename pointing to the file containing this
36
36
  # item’s content
37
- attr_reader :raw_filename
37
+ attr_reader :raw_filename
38
38
 
39
39
  # @return [Nanoc::Site] The site this item belongs to
40
40
  attr_accessor :site
@@ -175,7 +175,7 @@ module Nanoc
175
175
  # TODO [in nanoc 4.0] remove me
176
176
  if key.to_s =~ /^content_for_(.*)$/
177
177
  @@_content_for_warning_issued ||= false
178
- @@_Nanoc_Helpers_Capturing_included ||= false
178
+ @@_capturing_helper_included ||= false
179
179
 
180
180
  # Warn
181
181
  unless @@_content_for_warning_issued
@@ -184,9 +184,9 @@ module Nanoc
184
184
  end
185
185
 
186
186
  # Include capturing helper if necessary
187
- unless @@_Nanoc_Helpers_Capturing_included
187
+ unless @@_capturing_helper_included
188
188
  self.class.send(:include, ::Nanoc::Helpers::Capturing)
189
- @@_Nanoc_Helpers_Capturing_included = true
189
+ @@_capturing_helper_included = true
190
190
  end
191
191
 
192
192
  # Get content
@@ -207,7 +207,7 @@ module Nanoc
207
207
 
208
208
  # @return [Boolean] True if the item is binary; false if it is not
209
209
  def binary?
210
- !!@is_binary
210
+ @is_binary
211
211
  end
212
212
 
213
213
  # Returns the type of this object. Will always return `:item`, because
@@ -226,7 +226,7 @@ module Nanoc
226
226
  #
227
227
  # @return [Object] An unique reference to this object
228
228
  def reference
229
- [ type, identifier ]
229
+ [type, identifier]
230
230
  end
231
231
 
232
232
  # Prevents all further modifications to its attributes.