lib/nanoc/base/entities/document.rb in nanoc-4.8.2 vs lib/nanoc/base/entities/document.rb in nanoc-4.8.3
- old
+ new
@@ -13,11 +13,11 @@
def attributes
@attributes.value
end
# @return [Nanoc::Identifier]
- attr_accessor :identifier
+ attr_reader :identifier
# @return [String, nil]
attr_accessor :checksum_data
# @return [String, nil]
@@ -77,9 +77,14 @@
# @abstract
#
# @return Unique reference to this object
def reference
raise NotImplementedError
+ end
+
+ contract C::Or[Nanoc::Identifier, String] => Nanoc::Identifier
+ def identifier=(new_identifier)
+ @identifier = Nanoc::Identifier.from(new_identifier)
end
contract C::None => String
def inspect
"<#{self.class} identifier=\"#{identifier}\">"