Class: Zenweb::TagDetail

Inherits:
TagIndex show all
Defined in:
lib/zenweb/page.rb

Overview

Generates a virtual page with an index for a given tag on the given pages. You must subclass and provide a content method.

Constant Summary

Constants inherited from Page

Page::KRAMDOWN_CONFIG

Instance Attribute Summary collapse

Attributes inherited from GeneratedIndex

#pages

Attributes inherited from FakePage

#content, #date

Attributes inherited from Page

#binary, #parent, #path, #site, #subpages

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TagIndex

tag_list, tags_for

Methods inherited from GeneratedIndex

collate_by, #content, page_url, #wire

Methods inherited from Page

#[], #all_subpages, #all_subpages_by_level, #analytics, #body, #breadcrumbs, #change_frequency, #clean_url, #config, #content, #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, #wire

Constructor Details

#initialize(site, path, pages, tag) ⇒ TagDetail

Returns a new instance of TagDetail.



589
590
591
592
# File 'lib/zenweb/page.rb', line 589

def initialize site, path, pages, tag
  super site, path, pages
  self.tag = tag
end

Dynamic Method Handling

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

Instance Attribute Details

#tagObject

Returns the value of attribute tag.



576
577
578
# File 'lib/zenweb/page.rb', line 576

def tag
  @tag
end

Class Method Details

.allObject



578
579
580
# File 'lib/zenweb/page.rb', line 578

def self.all
  @@all ||= {}
end

.generate_all(site, dir, pages) ⇒ Object



582
583
584
585
586
587
# File 'lib/zenweb/page.rb', line 582

def self.generate_all site, dir, pages
  tags_for(pages).sort.each do |tag, pgs|
    path = tag.downcase.gsub(/\W+/, '')
    self.all[tag] = self.new site, "#{dir}/#{path}.html.md.erb", pgs, tag
  end
end

Instance Method Details

#indexObject



594
595
596
# File 'lib/zenweb/page.rb', line 594

def index
  self.class.tag_list tag, pages
end