Skip to content

Commit

Permalink
Refactor: Improve var names in #compiled_content
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdefreyne committed Dec 24, 2016
1 parent 8fad172 commit 49e27f1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/nanoc/base/entities/item_rep.rb
Expand Up @@ -66,11 +66,12 @@ def binary?
def compiled_content(snapshot: nil)
# Get name of last pre-layout snapshot
snapshot_name = snapshot || (@snapshot_contents[:pre] ? :pre : :last)
is_moving = [:pre, :post, :last].include?(snapshot_name)
is_movable = [:pre, :post, :last].include?(snapshot_name)

# Check existance of snapshot
snapshot_def = snapshot_defs.reverse.find { |sd| sd.name == snapshot_name }
if !is_moving && (snapshot_def.nil? || !snapshot_def.final?)
is_final = snapshot_def && snapshot_def.final?
if !is_movable && !is_final
raise Nanoc::Int::Errors::NoSuchSnapshot.new(self, snapshot_name)
end

Expand All @@ -80,7 +81,7 @@ def compiled_content(snapshot: nil)
when :post, :last
true
when :pre
snapshot_def.nil? || !snapshot_def.final?
!is_final
end
is_usable_snapshot = @snapshot_contents[snapshot_name] && (compiled? || !is_still_moving)
unless is_usable_snapshot
Expand Down

0 comments on commit 49e27f1

Please sign in to comment.