class Zine::Page::FormattedData

the meta data, passed formatted to the template

Attributes

data[RW]
header_partial[RW]
html[RW]
page[R]
uri[RW]

Public Class Methods

new(front_matter, site_opt) click to toggle source
# File lib/zine/page.rb, line 30
def initialize(front_matter, site_opt)
  site = site_opt['options']
  @page = { date_rfc3339: front_matter['date'],
            date_us: parse_date(front_matter['date']),
            github_name: site['github_name'],
            links_array: site_opt['links'],
            num_items_on_home: site['num_items_on_home'],
            site_author: site['site_author'],
            site_description: site['site_description'],
            site_name: site['site_name'],
            site_URL: site['site_URL'],
            tags: slugify_tags(front_matter['tags']),
            title: html_escape(front_matter['title']),
            twitter_name: site['twitter_name'],
            uri: '' } # uri only generated for posts, and not until after markdown, TO DO
end

Public Instance Methods

public_binding() click to toggle source
# File lib/zine/page.rb, line 47
def public_binding
  binding
end

Private Instance Methods

parse_date(front_matter_date) click to toggle source
# File lib/zine/page.rb, line 53
def parse_date(front_matter_date)
  DateTime.rfc3339(front_matter_date).strftime('%B %-d, %Y')
rescue ArgumentError
  ''
end
slugify_tags(tags) click to toggle source
# File lib/zine/page.rb, line 59
def slugify_tags(tags)
  return unless tags && tags.any?
  tags.map { |tag| { name: tag, tag_slug: Page.slug(tag) } }
end