Module: ContextExposer::BaseController
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/context_exposer/base_controller.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#configure_exposed_context ⇒ Object
must be called after Controller is instantiated.
- #configured_exposed_context? ⇒ Boolean
- #view_context ⇒ Object (also: #context)
Instance Method Details
#configure_exposed_context ⇒ Object
must be called after Controller is instantiated
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/context_exposer/base_controller.rb', line 56 def configure_exposed_context return if configured_exposed_context? clazz = self.class exposed_methods = clazz.send(:exposure_hash)[clazz.to_s] || [] # puts "exposed_methods for: #{clazz} - #{exposed_methods}" exposed_methods.each do |name, procedure| view_context.send :define_singleton_method, name do procedure.call end end @configured_exposed_context = true end |
#configured_exposed_context? ⇒ Boolean
69 70 71 |
# File 'lib/context_exposer/base_controller.rb', line 69 def configured_exposed_context? @configured_exposed_context == true end |
#view_context ⇒ Object Also known as: context
10 11 12 |
# File 'lib/context_exposer/base_controller.rb', line 10 def view_context @view_context ||= build_view_context end |