Class: JekyllPagesApi::GeneratedPage
- Inherits:
-
Object
- Object
- JekyllPagesApi::GeneratedPage
- Defined in:
- lib/jekyll_pages_api/generated_page.rb
Overview
Used by GeneratedSite to mimic a Jekyll page object when processing an already-generated site using the Generator.
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#relative_path ⇒ Object
readonly
Returns the value of attribute relative_path.
Instance Method Summary collapse
-
#initialize(path, basedir, title_prefix, body_element_tag, content) ⇒ GeneratedPage
constructor
A new instance of GeneratedPage.
Constructor Details
#initialize(path, basedir, title_prefix, body_element_tag, content) ⇒ GeneratedPage
Returns a new instance of GeneratedPage.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/jekyll_pages_api/generated_page.rb', line 17 def initialize(path, basedir, title_prefix, body_element_tag, content) unless path.start_with? basedir raise "#{path} does not start with #{basedir}" end @path = path basedir_len = basedir.size basedir_len -= File::SEPARATOR.size if basedir.end_with? File::SEPARATOR end_path = path.size index_suffix = File.join "", "index.html" end_path -= index_suffix.size if path.end_with? index_suffix @relative_path = (path[basedir_len..end_path] || "") @data, @content = GeneratedPageParser.parse_generated_page( content, title_prefix, body_element_tag) end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
9 10 11 |
# File 'lib/jekyll_pages_api/generated_page.rb', line 9 def content @content end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
9 10 11 |
# File 'lib/jekyll_pages_api/generated_page.rb', line 9 def data @data end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
9 10 11 |
# File 'lib/jekyll_pages_api/generated_page.rb', line 9 def path @path end |
#relative_path ⇒ Object (readonly)
Returns the value of attribute relative_path.
9 10 11 |
# File 'lib/jekyll_pages_api/generated_page.rb', line 9 def relative_path @relative_path end |