Class: Zine::Page::FormattedData

Inherits:
Object
  • Object
show all
Includes:
ERB::Util
Defined in:
lib/zine/page.rb

Overview

the meta data, passed formatted to the template

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(front_matter, site_opt) ⇒ FormattedData

Returns a new instance of FormattedData.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/zine/page.rb', line 29

def initialize(front_matter, site_opt)
  @config = site_opt
  options =  @config['options']
  @page = { date_rfc3339: front_matter['date'],
            date_rfc822: parse_822_date(front_matter['date']),
            date_us: parse_date(front_matter['date']),
            github_name: options['github_name'],
            links_array: @config['links'],
            num_items_on_home: options['num_items_on_home'],
            site_author: options['site_author'],
            site_description: options['site_description'],
            site_name: options['site_name'],
            site_URL: options['site_URL'],
            tags: slugify_tags(front_matter['tags']),
            title: html_escape(front_matter['title']),
            twitter_name: options['twitter_name'],
            uri: '' } # uri only generated for posts, and not until after markdown, TO DO
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



26
27
28
# File 'lib/zine/page.rb', line 26

def config
  @config
end

#dataObject

Returns the value of attribute data.



26
27
28
# File 'lib/zine/page.rb', line 26

def data
  @data
end

Returns the value of attribute footer_partial.



26
27
28
# File 'lib/zine/page.rb', line 26

def footer_partial
  @footer_partial
end

#header_partialObject

Returns the value of attribute header_partial.



26
27
28
# File 'lib/zine/page.rb', line 26

def header_partial
  @header_partial
end

#htmlObject

Returns the value of attribute html.



26
27
28
# File 'lib/zine/page.rb', line 26

def html
  @html
end

#pageObject (readonly)

Returns the value of attribute page.



27
28
29
# File 'lib/zine/page.rb', line 27

def page
  @page
end

#uriObject

Returns the value of attribute uri.



26
27
28
# File 'lib/zine/page.rb', line 26

def uri
  @uri
end

Instance Method Details

#public_bindingObject



48
49
50
# File 'lib/zine/page.rb', line 48

def public_binding
  binding
end