Class: Middleman::OrgExtension
- Inherits:
-
Extension
- Object
- Extension
- Middleman::OrgExtension
- Defined in:
- lib/middleman-org/extension.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
option :resources, ‘resources’, ‘folder name for resources’.
Instance Method Summary collapse
- #after_configuration ⇒ Object
-
#initialize(app, options_hash = {}, &block) ⇒ OrgExtension
constructor
A new instance of OrgExtension.
Constructor Details
#initialize(app, options_hash = {}, &block) ⇒ OrgExtension
Returns a new instance of OrgExtension.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/middleman-org/extension.rb', line 15 def initialize(app, = {}, &block) # Call super to build options from the options_hash super # Require libraries only when activated require 'org-ruby' require 'middleman-org/org_data' .root = File.join(.prefix, .root) if .prefix app.after_configuration do template_extensions org: :html end # set up your extension # puts options.my_option end |
Instance Attribute Details
#data ⇒ Object (readonly)
option :resources, ‘resources’, ‘folder name for resources’
12 13 14 |
# File 'lib/middleman-org/extension.rb', line 12 def data @data end |
Instance Method Details
#after_configuration ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/middleman-org/extension.rb', line 33 def after_configuration ::Middleman::Org.controller = 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 || 'UTC' zone_default = Time.find_zone!(time_zone) unless zone_default raise 'Value assigned to time_zone not recognized.' end Time.zone_default = zone_default @data = Org::OrgData.new(@app, self, ) @app.sitemap.register_resource_list_manipulator(:"org_articles", @data, false) end |