lib/nanoc/base/compilation/rules_collection.rb in nanoc-3.7.3 vs lib/nanoc/base/compilation/rules_collection.rb in nanoc-3.7.4

- old
+ new

@@ -74,11 +74,11 @@ # Loads this site’s rules. # # @return [void] def load # Find rules file - rules_filenames = [ 'Rules', 'rules', 'Rules.rb', 'rules.rb' ] + rules_filenames = ['Rules', 'rules', 'Rules.rb', 'rules.rb'] rules_filename = rules_filenames.find { |f| File.file?(f) } raise Nanoc::Errors::NoRulesFileFound.new if rules_filename.nil? parse(rules_filename) end @@ -139,11 +139,11 @@ # # @return [Hash<Symbol, Nanoc::Rule>] The routing rules for the given rep def routing_rules_for(rep) rules = {} @item_routing_rules.each do |rule| - next if !rule.applicable_to?(rep.item) + next unless rule.applicable_to?(rep.item) next if rule.rep_name != rep.name next if rules.key?(rule.snapshot_name) rules[rule.snapshot_name] = rule end @@ -191,11 +191,11 @@ # # @return [Array] The rule memory for the given item representation def new_rule_memory_for_rep(rep) recording_proxy = rep.to_recording_proxy compilation_rule_for(rep).apply_to(recording_proxy, :compiler => @compiler) - recording_proxy.rule_memory << [ :write, rep.path ] + recording_proxy.rule_memory << [:write, rep.path] make_rule_memory_serializable(recording_proxy.rule_memory) end memoize :new_rule_memory_for_rep # Makes the given rule memory serializable by calling @@ -206,11 +206,11 @@ # # @return [Array] The serializable rule memory def make_rule_memory_serializable(rs) rs.map do |r| if r[0] == :filter - [ r[0], r[1], r[2].to_a.map { |a| Nanoc::Checksummer.calc(a) } ] + [r[0], r[1], r[2].to_a.map { |a| Nanoc::Checksummer.calc(a) }] else r end end end @@ -229,10 +229,10 @@ # @return [Array] A list of snapshots, represented as arrays where the # first element is the snapshot name (a Symbol) and the last element is # a Boolean indicating whether the snapshot is final or not def snapshots_for(rep) new_rule_memory_for_rep(rep).select { |e| e[0] == :snapshot }.map do |e| - [ e[1], e[2].fetch(:final) { true } ] + [e[1], e[2].fetch(:final) { true }] end end # @param [Nanoc::Item] obj The object for which to check the rule memory #