Class: Lookbook::PageSection

Inherits:
Page show all
Defined in:
lib/lookbook/entities/page_section.rb

Instance Attribute Summary collapse

Attributes inherited from Page

#content, #sections

Instance Method Summary collapse

Methods inherited from Page

#add_section, #data, #footer?, #header?, #markdown?, #method_missing, #respond_to_missing?, #search_terms, #title

Methods inherited from Entity

#<=>, #id, #label, #type

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

#parentObject 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

Returns:

  • (Boolean)


24
25
26
# File 'lib/lookbook/entities/page_section.rb', line 24

def landing?
  false
end

#lookup_pathObject



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

#nameObject



11
12
13
# File 'lib/lookbook/entities/page_section.rb', line 11

def name
  Utils.name(name_parts[:name])
end

#url_pathObject



28
29
30
# File 'lib/lookbook/entities/page_section.rb', line 28

def url_path
  nil
end