Module: Mensa::ApplicationHelper

Included in:
ApplicationComponent
Defined in:
app/helpers/mensa/application_helper.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



17
18
19
# File 'app/helpers/mensa/application_helper.rb', line 17

def method_missing(method, *args, **kwargs, &block)
  main_app.send(method, *args, **kwargs, &block)
end

Instance Method Details

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

Returns:

  • (Boolean)


9
10
11
12
13
14
15
# File 'app/helpers/mensa/application_helper.rb', line 9

def respond_to_missing?(method, include_private = false)
  if method.to_s.ends_with?("_url") || method.to_s.ends_with?("_path") && main_app.respond_to?(method)
    true
  else
    super
  end
end

#table(name, config = {}, **options) ⇒ Object



3
4
5
6
7
# File 'app/helpers/mensa/application_helper.rb', line 3

def table(name, config = {}, **options)
  component = ::Mensa::Table::Component.new(name, config, **options)
  component.original_view_context = self
  render(component)
end