Module: Context::Controller
- Defined in:
- lib/context/controller.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/context/controller.rb', line 18
def method_missing(method_name, *args, &block)
if @__context.respond_to?(method_name)
@__context.public_send(method_name, *args, &block)
else
super
end
end
|
Class Method Details
.included(base) ⇒ Object
3
4
5
|
# File 'lib/context/controller.rb', line 3
def self.included(base)
base.send(:prepend_before_action, :__set_base_context)
end
|
Instance Method Details
#__set_base_context ⇒ Object
12
13
14
|
# File 'lib/context/controller.rb', line 12
def __set_base_context
@__context = Context::BaseContext.new
end
|
#extend_context(context, **args) ⇒ Object
7
8
9
10
|
# File 'lib/context/controller.rb', line 7
def extend_context(context, **args)
context_class = "#{context}Context".constantize
@__context = context_class.wrap(@__context, **args)
end
|