Method: Middleman::Extension.expose_to_config

Defined in:
lib/middleman-core/extension.rb

.expose_to_config(*symbols)

This method returns an undefined value.

Takes a method within this extension and exposes it inside the scope of the config.rb sandbox.

Examples:

with Hash:

expose_to_config global_name: :local_name

with Array:

expose_to_config :method1, :method2

Parameters:

  • symbols (Array<Sumbol>, Hash<Symbol, Symbol>)

    An optional list of symbols representing instance methods to exposed.



228
229
230
231
232
233
234
235
236
237
238
# File 'lib/middleman-core/extension.rb', line 228

def expose_to_config(*symbols)
  self.exposed_to_config ||= {}

  if symbols.first && symbols.first.is_a?(Hash)
    self.exposed_to_config.merge!(symbols.first)
  elsif symbols.is_a? Array
    symbols.each do |sym|
      self.exposed_to_config[sym] = sym
    end
  end
end