Class: Nanoc::Int::Site Private
- Inherits:
-
Object
- Object
- Nanoc::Int::Site
- Includes:
- ContractsSupport
- Defined in:
- lib/nanoc/base/entities/site.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
- #code_snippets ⇒ Object readonly private
-
#compiler ⇒ Nanoc::Int::Compiler
private
Returns the compiler for this site.
- #config ⇒ Object readonly private
- #items ⇒ Object readonly private
- #layouts ⇒ Object readonly private
Instance Method Summary collapse
-
#compile ⇒ void
private
Compiles the site.
- #ensure_identifier_uniqueness(objects, type) ⇒ Object private
-
#freeze ⇒ void
private
Prevents all further modifications to itself, its items, its layouts etc.
-
#initialize(config:, code_snippets:, items:, layouts:) ⇒ Site
constructor
private
A new instance of Site.
Methods included from ContractsSupport
Constructor Details
#initialize(config:, code_snippets:, items:, layouts:) ⇒ Site
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 Site.
13 14 15 16 17 18 19 20 21 |
# File 'lib/nanoc/base/entities/site.rb', line 13 def initialize(config:, code_snippets:, items:, layouts:) @config = config @code_snippets = code_snippets @items = items @layouts = layouts ensure_identifier_uniqueness(@items, 'item') ensure_identifier_uniqueness(@layouts, 'layout') end |
Instance Attribute Details
#code_snippets ⇒ Object (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.
43 44 45 |
# File 'lib/nanoc/base/entities/site.rb', line 43 def code_snippets @code_snippets end |
#compiler ⇒ Nanoc::Int::Compiler
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 the compiler for this site. Will create a new compiler if none exists yet.
39 40 41 |
# File 'lib/nanoc/base/entities/site.rb', line 39 def compiler @compiler end |
#config ⇒ Object (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.
44 45 46 |
# File 'lib/nanoc/base/entities/site.rb', line 44 def config @config end |
#items ⇒ Object (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.
45 46 47 |
# File 'lib/nanoc/base/entities/site.rb', line 45 def items @items end |
#layouts ⇒ Object (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.
46 47 48 |
# File 'lib/nanoc/base/entities/site.rb', line 46 def layouts @layouts end |
Instance Method Details
#compile ⇒ 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.
Compiles the site.
29 30 31 32 |
# File 'lib/nanoc/base/entities/site.rb', line 29 def compile compiler.run_all self end |
#ensure_identifier_uniqueness(objects, type) ⇒ 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.
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/nanoc/base/entities/site.rb', line 61 def ensure_identifier_uniqueness(objects, type) seen = Set.new objects.each do |obj| if seen.include?(obj.identifier) raise Nanoc::Int::Errors::DuplicateIdentifier.new(obj.identifier, type) end seen << obj.identifier end self 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.
Prevents all further modifications to itself, its items, its layouts etc.
52 53 54 55 56 57 58 |
# File 'lib/nanoc/base/entities/site.rb', line 52 def freeze config.freeze items.freeze layouts.freeze code_snippets.__nanoc_freeze_recursively self end |