lib/nanoc/base/compilation/compiler.rb in nanoc-3.7.3 vs lib/nanoc/base/compilation/compiler.rb in nanoc-3.7.4
- old
+ new
@@ -72,11 +72,11 @@
# when not outdated. These arguments and options are, as of nanoc 3.2, no
# longer used, and will simply be ignored when passed to {#run}.
#
# @overload run
# @return [void]
- def run(*args)
+ def run(*_args)
# Create output directory if necessary
FileUtils.mkdir_p(@site.config[:output_dir])
# Compile reps
load
@@ -204,11 +204,11 @@
# site configuration and the rules).
#
# @api private
def objects
site.items + site.layouts + site.code_snippets +
- [ site.config, rules_collection ]
+ [site.config, rules_collection]
end
# Creates the representations of all items as defined by the compilation
# rules.
#
@@ -248,15 +248,16 @@
rep.raw_paths[snapshot] = @site.config[:output_dir] + basic_path
# Get normal path by stripping index filename
rep.paths[snapshot] = basic_path
@site.config[:index_filenames].each do |index_filename|
- if rep.paths[snapshot][-index_filename.length..-1] == index_filename
- # Strip and stop
- rep.paths[snapshot] = rep.paths[snapshot][0..-index_filename.length - 1]
- break
- end
+ rep_path_ending = rep.paths[snapshot][-index_filename.length..-1]
+ next unless rep_path_ending == index_filename
+
+ # Strip and stop
+ rep.paths[snapshot] = rep.paths[snapshot][0..-index_filename.length - 1]
+ break
end
end
end
end
@@ -292,11 +293,11 @@
:checksum_store => checksum_store,
:dependency_tracker => dependency_tracker)
end
memoize :outdatedness_checker
- private
+ private
# @return [Array<Nanoc::Item>] The site’s items
def items
@site.items
end
@@ -322,11 +323,11 @@
def compile_reps(reps)
content_dependency_graph = Nanoc::DirectedGraph.new(reps)
# Listen to processing start/stop
Nanoc::NotificationCenter.on(:processing_started, self) { |obj| @stack.push(obj) }
- Nanoc::NotificationCenter.on(:processing_ended, self) { |obj| @stack.pop }
+ Nanoc::NotificationCenter.on(:processing_ended, self) { |_obj| @stack.pop }
# Assign snapshots
reps.each do |rep|
rep.snapshots = rules_collection.snapshots_for(rep)
end
@@ -348,10 +349,10 @@
end
end
end
# Check whether everything was compiled
- if !content_dependency_graph.vertices.empty?
+ unless content_dependency_graph.vertices.empty?
raise Nanoc::Errors::RecursiveCompilation.new(content_dependency_graph.vertices)
end
ensure
Nanoc::NotificationCenter.remove(:processing_started, self)
Nanoc::NotificationCenter.remove(:processing_ended, self)