Module: Gifted::ViewHelpers

Defined in:
lib/gifted/view_helpers.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



5
6
7
8
# File 'lib/gifted/view_helpers.rb', line 5

def method_missing(method_name, *args, &block)
  view_context = Gifted::ViewContext.current
  view_context&.respond_to?(method_name) ? view_context.send(method_name, *args, &block) : super
end

Instance Method Details

#controllerObject



14
15
16
# File 'lib/gifted/view_helpers.rb', line 14

def controller
  @controller ||= Gifted::ViewContext.current.instance_variable_get(:@_controller)
end

#respond_to_missing?(method_name, *args) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/gifted/view_helpers.rb', line 10

def respond_to_missing?(method_name, *args)
  Gifted::ViewContext.current.respond_to?(method_name) || super
end