Class: Lookbook::PageSection
- Defined in:
- lib/lookbook/entities/page_section.rb
Instance Attribute Summary collapse
-
#parent ⇒ Object
(also: #page)
Returns the value of attribute parent.
Attributes inherited from Page
Instance Method Summary collapse
-
#initialize(file_path) ⇒ PageSection
constructor
A new instance of PageSection.
- #landing? ⇒ Boolean
- #lookup_path ⇒ Object
- #name ⇒ Object
- #url_path ⇒ Object
Methods inherited from Page
#add_section, #data, #footer?, #header?, #markdown?, #method_missing, #respond_to_missing?, #search_terms, #title
Methods inherited from Entity
Constructor Details
#initialize(file_path) ⇒ PageSection
Returns a new instance of PageSection.
5 6 7 8 9 |
# File 'lib/lookbook/entities/page_section.rb', line 5 def initialize(file_path) @file_path = Pathname(file_path) @parent = nil super end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Lookbook::Page
Instance Attribute Details
#parent ⇒ Object Also known as: page
Returns the value of attribute parent.
3 4 5 |
# File 'lib/lookbook/entities/page_section.rb', line 3 def parent @parent end |
Instance Method Details
#landing? ⇒ Boolean
24 25 26 |
# File 'lib/lookbook/entities/page_section.rb', line 24 def landing? false end |
#lookup_path ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/lookbook/entities/page_section.rb', line 15 def lookup_path directory = if relative_directory_path.present? && !relative_directory_path.to_s.start_with?(".") relative_directory_path end path = PathUtils.to_path(directory, name_parts[:parent_name]) PathUtils.to_lookup_path(path) end |
#name ⇒ Object
11 12 13 |
# File 'lib/lookbook/entities/page_section.rb', line 11 def name Utils.name(name_parts[:name]) end |
#url_path ⇒ Object
28 29 30 |
# File 'lib/lookbook/entities/page_section.rb', line 28 def url_path nil end |