class Nanoc::Int::Document

@api private

Attributes

attributes[R]

@return [Hash]

content[R]

@return [Nanoc::Int::Content]

identifier[RW]

@return [Nanoc::Identifier]

Public Class Methods

new(content, attributes, identifier) click to toggle source

@param [String, Nanoc::Int::Content] content

@param [Hash] attributes

@param [String, Nanoc::Identifier] identifier

# File lib/nanoc/base/entities/document.rb, line 19
def initialize(content, attributes, identifier)
  @content = Nanoc::Int::Content.create(content)
  @attributes = attributes.__nanoc_symbolize_keys_recursively
  @identifier = Nanoc::Identifier.from(identifier)
end

Public Instance Methods

==(other) click to toggle source
# File lib/nanoc/base/entities/document.rb, line 47
def ==(other)
  other.respond_to?(:identifier) && identifier == other.identifier
end
Also aliased as: eql?
eql?(other)
Alias for: ==
freeze() click to toggle source

@return [void]

Calls superclass method
# File lib/nanoc/base/entities/document.rb, line 26
def freeze
  super
  attributes.__nanoc_freeze_recursively
  content.freeze
end
hash() click to toggle source
# File lib/nanoc/base/entities/document.rb, line 43
def hash
  self.class.hash ^ identifier.hash
end
inspect() click to toggle source
# File lib/nanoc/base/entities/document.rb, line 39
def inspect
  "<#{self.class} identifier=\"#{identifier}\">"
end
reference() click to toggle source

@abstract

@return Unique reference to this object

# File lib/nanoc/base/entities/document.rb, line 35
def reference
  raise NotImplementedError
end