Module: Middleman::CoreExtensions::Extensions::ClassMethods
- Defined in:
- lib/middleman-core/core_extensions/extensions.rb
Overview
Class methods
Instance Method Summary collapse
-
#configure(env, &block) ⇒ void
Add a callback to run in a specific environment.
-
#extensions ⇒ Array<Module>
Alias ‘extensions` to access registered extensions.
-
#register(extension, options = {}, &block) ⇒ void
Register a new extension.
Instance Method Details
#configure(env, &block) ⇒ void
This method returns an undefined value.
Add a callback to run in a specific environment
67 68 69 |
# File 'lib/middleman-core/core_extensions/extensions.rb', line 67 def configure(env, &block) send("#{env}_config", &block) end |
#extensions ⇒ Array<Module>
Alias ‘extensions` to access registered extensions
74 75 76 |
# File 'lib/middleman-core/core_extensions/extensions.rb', line 74 def extensions @extensions ||= [] end |
#register(extension, options = {}, &block) ⇒ void
This method returns an undefined value.
Register a new extension
83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/middleman-core/core_extensions/extensions.rb', line 83 def register(extension, ={}, &block) @extensions ||= [] @extensions += [extension] extend extension if extension.respond_to?(:registered) if extension.method(:registered).arity === 1 extension.registered(self, &block) else extension.registered(self, , &block) end end end |