Class: Nanoc::Int::Document Private
- Inherits:
-
Object
- Object
- Nanoc::Int::Document
- Includes:
- ContractsSupport
- Defined in:
- lib/nanoc/base/entities/document.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #checksum_data ⇒ String? private
- #content ⇒ Nanoc::Int::Content readonly private
- #identifier ⇒ Nanoc::Identifier private
Instance Method Summary collapse
- #==(other) ⇒ Object private
- #attributes ⇒ Hash private
- #eql?(other) ⇒ Boolean private
- #freeze ⇒ void private
- #hash ⇒ Object private
-
#initialize(content, attributes, identifier, checksum_data: nil) ⇒ Document
constructor
private
A new instance of Document.
- #inspect ⇒ Object private
-
#reference ⇒ Object
abstract
private
Unique reference to this object.
Methods included from ContractsSupport
Constructor Details
#initialize(content, attributes, identifier, checksum_data: nil) ⇒ Document
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Document.
34 35 36 37 38 39 |
# File 'lib/nanoc/base/entities/document.rb', line 34 def initialize(content, attributes, identifier, checksum_data: nil) @content = Nanoc::Int::Content.create(content) @attributes = Nanoc::Int::LazyValue.new(attributes).map(&:__nanoc_symbolize_keys_recursively) @identifier = Nanoc::Identifier.from(identifier) @checksum_data = checksum_data end |
Instance Attribute Details
#checksum_data ⇒ String?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 |
# File 'lib/nanoc/base/entities/document.rb', line 19 def checksum_data @checksum_data end |
#content ⇒ Nanoc::Int::Content (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
8 9 10 |
# File 'lib/nanoc/base/entities/document.rb', line 8 def content @content end |
#identifier ⇒ Nanoc::Identifier
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 |
# File 'lib/nanoc/base/entities/document.rb', line 16 def identifier @identifier end |
Instance Method Details
#==(other) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
69 70 71 |
# File 'lib/nanoc/base/entities/document.rb', line 69 def ==(other) other.respond_to?(:identifier) && identifier == other.identifier end |
#attributes ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/nanoc/base/entities/document.rb', line 11 def attributes @attributes.value end |
#eql?(other) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
74 75 76 |
# File 'lib/nanoc/base/entities/document.rb', line 74 def eql?(other) other.is_a?(self.class) && identifier == other.identifier end |
#freeze ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
43 44 45 46 47 48 |
# File 'lib/nanoc/base/entities/document.rb', line 43 def freeze super @content.freeze @attributes.freeze self end |
#hash ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
64 65 66 |
# File 'lib/nanoc/base/entities/document.rb', line 64 def hash self.class.hash ^ identifier.hash end |
#inspect ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
59 60 61 |
# File 'lib/nanoc/base/entities/document.rb', line 59 def inspect "<#{self.class} identifier=\"#{identifier}\">" end |
#reference ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Unique reference to this object.
54 55 56 |
# File 'lib/nanoc/base/entities/document.rb', line 54 def reference raise NotImplementedError end |