Module: WCC::Contentful::App
- Defined in:
- lib/wcc/contentful/app/version.rb,
lib/wcc/contentful/app/exceptions.rb,
app/mailers/wcc/contentful/app/contact_mailer.rb,
lib/wcc/contentful/app/custom_markdown_render.rb,
app/models/wcc/contentful/app/contact_form_submission.rb,
lib/wcc/contentful/app/engine.rb,
lib/wcc/contentful/app.rb
Defined Under Namespace
Modules: MenuHelper, PreviewPassword, SectionHelper Classes: Configuration, ContactFormController, ContactFormSubmission, ContactMailer, CustomMarkdownRender, Engine, MarkdownRenderer, PageNotFoundError, PagesController, ValidationError
Constant Summary collapse
- VERSION =
'1.7.0'
Class Attribute Summary collapse
-
.configuration ⇒ Object
readonly
Gets the current configuration, after calling WCC::Contentful::App.configure.
-
.initialized ⇒ Object
readonly
Returns the value of attribute initialized.
Class Method Summary collapse
Class Attribute Details
.configuration ⇒ Object (readonly)
Gets the current configuration, after calling WCC::Contentful::App.configure
15 16 17 |
# File 'lib/wcc/contentful/app.rb', line 15 def configuration @configuration end |
.initialized ⇒ Object (readonly)
Returns the value of attribute initialized.
12 13 14 |
# File 'lib/wcc/contentful/app.rb', line 12 def initialized @initialized end |
Class Method Details
.configure ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/wcc/contentful/app.rb', line 18 def self.configure if initialized || WCC::Contentful.initialized raise WCC::Contentful::InitializationError, 'Cannot configure after initialization' end WCC::Contentful.configure do |wcc_contentful_config| if @configuration&.wcc_contentful_config != wcc_contentful_config @configuration = Configuration.new(wcc_contentful_config) end yield(configuration) end configuration.validate! configuration end |
.db_connected? ⇒ Boolean
60 61 62 |
# File 'lib/wcc/contentful/app.rb', line 60 def self.db_connected? @db_connected end |
.init! ⇒ Object
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/wcc/contentful/app.rb', line 35 def self.init! raise ArgumentError, 'Please first call WCC::Contentful::App.configure' if configuration.nil? WCC::Contentful.init! # Extend all model types w/ validation & extra fields WCC::Contentful::Model.schema.each_value do |t| file = File.dirname(__FILE__) + "/model/#{t.name.underscore}.rb" require file if File.exist?(file) end @db_connected = begin ::ActiveRecord::Base.connection_pool.with_connection(&:active?) rescue StandardError false end @configuration = WCC::Contentful::App::Configuration::FrozenConfiguration.new( configuration, WCC::Contentful.configuration ) @initialized = true end |