Class: Middleman::CoreExtensions::Routing::PageDescriptor
- Inherits:
-
Struct
- Object
- Struct
- Middleman::CoreExtensions::Routing::PageDescriptor
- Defined in:
- middleman-core/lib/middleman-core/core_extensions/routing.rb
Instance Attribute Summary collapse
-
#locals ⇒ Object
Returns the value of attribute locals.
-
#options ⇒ Object
Returns the value of attribute options.
-
#page ⇒ Object
Returns the value of attribute page.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
Instance Attribute Details
#locals ⇒ Object
Returns the value of attribute locals
14 15 16 |
# File 'middleman-core/lib/middleman-core/core_extensions/routing.rb', line 14 def locals @locals end |
#options ⇒ Object
Returns the value of attribute options
14 15 16 |
# File 'middleman-core/lib/middleman-core/core_extensions/routing.rb', line 14 def @options end |
#page ⇒ Object
Returns the value of attribute page
14 15 16 |
# File 'middleman-core/lib/middleman-core/core_extensions/routing.rb', line 14 def page @page end |
#path ⇒ Object
Returns the value of attribute path
14 15 16 |
# File 'middleman-core/lib/middleman-core/core_extensions/routing.rb', line 14 def path @path end |
Instance Method Details
#execute_descriptor(app, resource_list) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'middleman-core/lib/middleman-core/core_extensions/routing.rb', line 15 def execute_descriptor(app, resource_list) normalized_path = path.dup if normalized_path.is_a?(String) && !normalized_path.include?('*') # Normalize path normalized_path = ::Middleman::Util.normalize_path(normalized_path) normalized_path = ::File.join(normalized_path, app.config[:index_file]) if normalized_path.end_with?('/') || app.files.by_type(:source).watchers.any? { |w| (w.directory + Pathname(normalized_path)).directory? } end normalized_path = "/#{::Middleman::Util.strip_leading_slash(normalized_path)}" if normalized_path.is_a?(String) resource_list .select { |r| ::Middleman::Util.path_match(normalized_path, "/#{r.path}") } .each do |r| r.(locals, true) if locals if page if page.key?(:id) resource_list.update!(r, :page_id) do r.(page, true) end else r.(page, true) end end r.(, true) if end end |