Class: Confinement::Site
- Inherits:
-
Object
- Object
- Confinement::Site
- Defined in:
- lib/confinement.rb
Instance Attribute Summary collapse
-
#asset_blobs ⇒ Object
readonly
Returns the value of attribute asset_blobs.
-
#content_blobs ⇒ Object
readonly
Returns the value of attribute content_blobs.
-
#guesses ⇒ Object
Returns the value of attribute guesses.
-
#layout_blobs ⇒ Object
readonly
Returns the value of attribute layout_blobs.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
-
#route_identifiers ⇒ Object
readonly
Returns the value of attribute route_identifiers.
-
#view_context_helpers ⇒ Object
Returns the value of attribute view_context_helpers.
Instance Method Summary collapse
-
#initialize(config) {|_self| ... } ⇒ Site
constructor
A new instance of Site.
- #partial_compilation ⇒ Object
- #partial_compilation=(previous_partial_compilation) ⇒ Object
- #rules {|assets: @asset_blobs, layouts: @layout_blobs, contents: @content_blobs, routes: @route_identifiers| ... } ⇒ Object
Constructor Details
#initialize(config) {|_self| ... } ⇒ Site
Returns a new instance of Site.
231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/confinement.rb', line 231 def initialize(config) @root = config.root yield(self) @view_context_helpers ||= [] @guesses ||= Rendering.guesses @route_identifiers = RouteIdentifiers.new @asset_blobs = Blobs.new(scoped_root: config.source.assets_path, file_abstraction_class: Asset) @content_blobs = Blobs.new(scoped_root: config.source.contents_path, file_abstraction_class: Content) @layout_blobs = Blobs.new(scoped_root: config.source.layouts_path, file_abstraction_class: Layout) end |
Instance Attribute Details
#asset_blobs ⇒ Object (readonly)
Returns the value of attribute asset_blobs.
248 249 250 |
# File 'lib/confinement.rb', line 248 def asset_blobs @asset_blobs end |
#content_blobs ⇒ Object (readonly)
Returns the value of attribute content_blobs.
249 250 251 |
# File 'lib/confinement.rb', line 249 def content_blobs @content_blobs end |
#guesses ⇒ Object
Returns the value of attribute guesses.
253 254 255 |
# File 'lib/confinement.rb', line 253 def guesses @guesses end |
#layout_blobs ⇒ Object (readonly)
Returns the value of attribute layout_blobs.
250 251 252 |
# File 'lib/confinement.rb', line 250 def layout_blobs @layout_blobs end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
245 246 247 |
# File 'lib/confinement.rb', line 245 def root @root end |
#route_identifiers ⇒ Object (readonly)
Returns the value of attribute route_identifiers.
247 248 249 |
# File 'lib/confinement.rb', line 247 def route_identifiers @route_identifiers end |
#view_context_helpers ⇒ Object
Returns the value of attribute view_context_helpers.
252 253 254 |
# File 'lib/confinement.rb', line 252 def view_context_helpers @view_context_helpers end |
Instance Method Details
#partial_compilation ⇒ Object
275 276 277 |
# File 'lib/confinement.rb', line 275 def partial_compilation { asset_blobs: @asset_blobs } end |
#partial_compilation=(previous_partial_compilation) ⇒ Object
279 280 281 282 283 284 285 |
# File 'lib/confinement.rb', line 279 def partial_compilation=(previous_partial_compilation) return if previous_partial_compilation.nil? @asset_blobs = previous_partial_compilation.fetch(:asset_blobs) nil end |
#rules {|assets: @asset_blobs, layouts: @layout_blobs, contents: @content_blobs, routes: @route_identifiers| ... } ⇒ Object
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/confinement.rb', line 255 def rules yield( assets: @asset_blobs, layouts: @layout_blobs, contents: @content_blobs, routes: @route_identifiers ) guesser = Rendering::Guesser.new(guesses) guess_renderers(guesser, @layout_blobs) guess_renderers(guesser, @content_blobs) @asset_blobs.done! @layout_blobs.done! @content_blobs.done! @route_identifiers.done! nil end |