Class: Zenweb::GeneratedIndex
- Defined in:
- lib/zenweb/page.rb
Overview
Generates a virtual page with an index of all tags on the given pages. You must subclass and provide a content method.
Direct Known Subclasses
Constant Summary
Constants inherited from Page
Instance Attribute Summary collapse
-
#pages ⇒ Object
Returns the value of attribute pages.
Attributes inherited from FakePage
Attributes inherited from Page
#binary, #parent, #path, #site, #subpages
Class Method Summary collapse
- .collate_by(pages, key, default = nil) ⇒ Object
- .generate_all(site, dir, pages) ⇒ Object
-
.page_url(page) ⇒ Object
TODO: hard to do helpers on class methods.
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(site, path, pages) ⇒ GeneratedIndex
constructor
A new instance of GeneratedIndex.
- #wire ⇒ Object
Methods inherited from Page
#[], #all_subpages, #all_subpages_by_level, #analytics, #body, #breadcrumbs, #change_frequency, #clean_url, #config, #date, #date_from_path, #date_str, #dated?, #dated_path?, #depends_on, #disqus, #disqus_counts, #erb, #extend_md, #filetype, #filetypes, #format_date, #gauges_analytics, #generate, #google_ad, #google_analytics, #html?, #include, #index?, #inspect, #layout, #link_head, #link_html, #markdown, #meta, #method_missing, #no_index?, #parent_url, #render, #render_erb, #render_less, #render_md, renderers_re, #run_js_script, #series_page, #stale?, #stylesheet, #subrender, #tag_pages, #url, #url_dir, #url_path
Constructor Details
#initialize(site, path, pages) ⇒ GeneratedIndex
Returns a new instance of GeneratedIndex.
526 527 528 529 530 531 532 533 |
# File 'lib/zenweb/page.rb', line 526 def initialize site, path, pages super site, path self.pages = pages.select(&:html?) self.date = Time.now site.pages[path] = self end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Zenweb::Page
Instance Attribute Details
#pages ⇒ Object
Returns the value of attribute pages.
512 513 514 |
# File 'lib/zenweb/page.rb', line 512 def pages @pages end |
Class Method Details
.collate_by(pages, key, default = nil) ⇒ Object
514 515 516 |
# File 'lib/zenweb/page.rb', line 514 def self.collate_by pages, key, default=nil pages.multi_group_by { |page| page.config[key] || default } end |
.generate_all(site, dir, pages) ⇒ Object
518 519 520 |
# File 'lib/zenweb/page.rb', line 518 def self.generate_all site, dir, pages raise NotImplementedError, "Implement #{self}#generate_all" end |
.page_url(page) ⇒ Object
TODO: hard to do helpers on class methods
522 523 524 |
# File 'lib/zenweb/page.rb', line 522 def self.page_url page # TODO: hard to do helpers on class methods "[#{page.title}](#{page.clean_url})" end |
Instance Method Details
#content ⇒ Object
535 536 537 |
# File 'lib/zenweb/page.rb', line 535 def content raise NotImplementedError, "Implement #{self.class}#content" end |
#wire ⇒ Object
539 540 541 542 |
# File 'lib/zenweb/page.rb', line 539 def wire super self.depends_on pages end |