Module: Middleman::Sprockets::Extension::ExposeMiddlemanHelpers

Defined in:
lib/middleman-sprockets/extension/expose_middleman_helpers.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/middleman-sprockets/extension/expose_middleman_helpers.rb', line 9

def method_missing method, *args, &block
  if mm_context.respond_to?(method)
    return mm_context.send method, *args, &block
  end

  super
end

Instance Method Details

#mm_contextObject



5
6
7
# File 'lib/middleman-sprockets/extension/expose_middleman_helpers.rb', line 5

def mm_context
  @_mm_context ||= app.template_context_class.new(app, current_path: current_path)
end

#respond_to?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/middleman-sprockets/extension/expose_middleman_helpers.rb', line 17

def respond_to? method, include_private=false
  super || mm_context.respond_to?(method, include_private)
end