Class: Middleman::BlogPageExtension
- Inherits:
-
Extension
- Object
- Extension
- Middleman::BlogPageExtension
- Defined in:
- lib/middleman-blog_page/extension_3_1.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#uid ⇒ Object
Returns the value of attribute uid.
Instance Method Summary collapse
- #after_configuration ⇒ Object
-
#initialize(app, options_hash = {}, &block) ⇒ BlogPageExtension
constructor
A new instance of BlogPageExtension.
Constructor Details
#initialize(app, options_hash = {}, &block) ⇒ BlogPageExtension
Returns a new instance of BlogPageExtension.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/middleman-blog_page/extension_3_1.rb', line 14 def initialize(app, ={}, &block) super @uid = .name require 'middleman-blog_page/blog_page_data' require 'middleman-blog_page/blog_page_article' require 'active_support/core_ext/time/zones' # app.set :time_zone, 'UTC' # If "prefix" option is specified, all other paths are relative to it. if .prefix .prefix = "/#{.prefix}" unless .prefix.start_with? '/' .permalink = File.join(.prefix, .permalink) .sources = File.join(.prefix, .sources) end end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
12 13 14 |
# File 'lib/middleman-blog_page/extension_3_1.rb', line 12 def data @data end |
#uid ⇒ Object
Returns the value of attribute uid.
12 13 14 |
# File 'lib/middleman-blog_page/extension_3_1.rb', line 12 def uid @uid end |
Instance Method Details
#after_configuration ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/middleman-blog_page/extension_3_1.rb', line 33 def after_configuration @uid ||= "blog_page#{@app.blog_instances.keys.length}" @app.blog_page_instances[@uid.to_sym] = self # Make sure ActiveSupport's TimeZone stuff has something to work with, # allowing people to set their desired time zone via Time.zone or # set :time_zone Time.zone = app.config[:time_zone] if app.config[:time_zone] time_zone = Time.zone if Time.zone zone_default = Time.find_zone!(time_zone || 'UTC') unless zone_default raise 'Value assigned to time_zone not recognized.' end Time.zone_default = zone_default # Initialize blog with options @data = ::Middleman::BlogPage::BlogPageData.new(@app, , self) @app.sitemap.register_resource_list_manipulator( :"blog_#{uid}_pages", @data, false ) end |