lib/nanoc/base/compilation/outdatedness_checker.rb in nanoc-4.0.0b3 vs lib/nanoc/base/compilation/outdatedness_checker.rb in nanoc-4.0.0b4
- old
+ new
@@ -79,12 +79,12 @@
# whose outdatedness reason should be calculated.
#
# @return [Nanoc::Int::OutdatednessReasons::Generic, nil] The reason why the
# given object is outdated, or nil if the object is not outdated.
def basic_outdatedness_reason_for(obj)
- case obj.type
- when :item_rep
+ case obj
+ when Nanoc::Int::ItemRep
# Outdated if rules outdated
return Nanoc::Int::OutdatednessReasons::RulesModified if
rule_memory_differs_for(obj)
# Outdated if checksums are missing or different
@@ -102,13 +102,13 @@
# Outdated if configuration outdated
return Nanoc::Int::OutdatednessReasons::ConfigurationModified if object_modified?(site.config)
# Not outdated
return nil
- when :item
+ when Nanoc::Int::Item
obj.reps.find { |rep| basic_outdatedness_reason_for(rep) }
- when :layout
+ when Nanoc::Int::Layout
# Outdated if rules outdated
return Nanoc::Int::OutdatednessReasons::RulesModified if
rule_memory_differs_for(obj)
# Outdated if checksums are missing or different
@@ -134,11 +134,11 @@
# indefinitely. It should not be necessary to pass this a custom value.
#
# @return [Boolean] true if the object is outdated, false otherwise
def outdated_due_to_dependencies?(obj, processed = Set.new)
# Convert from rep to item if necessary
- obj = obj.item if obj.type == :item_rep
+ obj = obj.item if obj.is_a?(Nanoc::Int::ItemRep)
# Get from cache
if @objects_outdated_due_to_dependencies.key?(obj)
return @objects_outdated_due_to_dependencies[obj]
end
@@ -173,19 +173,19 @@
# @param obj
#
# @return [Boolean] false if either the new or the old checksum for the
# given object is not available, true if both checksums are available
def checksums_available?(obj)
- checksum_store[obj] && obj.__nanoc_checksum
+ checksum_store[obj] && Nanoc::Int::Checksummer.calc(obj)
end
memoize :checksums_available?
# @param obj
#
# @return [Boolean] false if the old and new checksums for the given
# object differ, true if they are identical
def checksums_identical?(obj)
- checksum_store[obj] == obj.__nanoc_checksum
+ checksum_store[obj] == Nanoc::Int::Checksummer.calc(obj)
end
memoize :checksums_identical?
# @param obj
#