Class: Lookbook::PageSection

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

Constant Summary

Constants inherited from Page

Lookbook::Page::FRONTMATTER_FIELDS

Constants included from Utils

Utils::FRONTMATTER_REGEX, Utils::POSITION_PREFIX_REGEX

Instance Attribute Summary

Attributes inherited from Page

#errors, #rel_path, #sections

Instance Method Summary collapse

Methods inherited from Page

all, any?, #content, create, exists?, find, #footer?, #full_path, #get, #header?, #hidden, #hidden?, #initialize, #label, #markdown?, #matchers, #method_missing, page_paths, #parent_collections_names, #position, #respond_to_missing?, section_path?

Methods inherited from Entity

#hidden?, #hierarchy_depth, #initialize, #label, #matchers, #position

Constructor Details

This class inherits a constructor from Lookbook::Page

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Lookbook::Page

Instance Method Details

#idObject



9
10
11
# File 'lib/lookbook/page_section.rb', line 9

def id
  "#{super}-#{name}"
end

#lookup_pathObject



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

def lookup_path
  "#{super}/#{name}"
end

#nameObject



3
4
5
6
7
# File 'lib/lookbook/page_section.rb', line 3

def name
  return @name if @name.present?
  matches = full_path.to_s.match(%r{\[(?<name>\w+)\]})
  @name ||= matches[:name]
end

#pathObject



17
18
19
# File 'lib/lookbook/page_section.rb', line 17

def path
  super.gsub("[#{name}]", "")
end

#typeObject



21
22
23
# File 'lib/lookbook/page_section.rb', line 21

def type
  :page_section
end

#url_pathObject



13
14
15
# File 'lib/lookbook/page_section.rb', line 13

def url_path
  nil
end