Class: ContentfulMiddleman::Core

Inherits:
Middleman::Extension
  • Object
show all
Includes:
Helpers
Defined in:
lib/contentful_middleman/core.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#contentful_instances, #localize, #localize_array, #localize_entry, #localize_value, #with_preview

Constructor Details

#initialize(app, options_hash = {}, &block) ⇒ Core

Returns a new instance of Core.



67
68
69
70
71
72
73
74
75
# File 'lib/contentful_middleman/core.rb', line 67

def initialize(app, options_hash = {}, &block)
  super
  @middleman_app = app

  this = self # Hack due to context change
  app.before_server do
    this.webhook_options
  end
end

Instance Attribute Details

#middleman_appObject (readonly)

Returns the value of attribute middleman_app.



66
67
68
# File 'lib/contentful_middleman/core.rb', line 66

def middleman_app
  @middleman_app
end

Instance Method Details

#after_configurationObject

Middleman hooks



80
81
82
83
84
# File 'lib/contentful_middleman/core.rb', line 80

def after_configuration
  massage_options

  ContentfulMiddleman.instances << (ContentfulMiddleman::Instance.new self)
end

#webhook_optionsObject



86
87
88
# File 'lib/contentful_middleman/core.rb', line 86

def webhook_options
  ::ContentfulMiddleman::WebhookHandler.start(options) if options.rebuild_on_webhook
end