Module: ContextExposer::BaseController

Extended by:
ActiveSupport::Concern
Includes:
Integrations::Base
Included in:
ResourceController
Defined in:
lib/context_exposer/base_controller.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#configure_exposed_contextObject

must be called after Controller is instantiated



75
76
77
78
79
80
81
82
83
84
# File 'lib/context_exposer/base_controller.rb', line 75

def configure_exposed_context
  return if configured_exposed_context?
  clazz = self.class
  exposed_methods = clazz.send(:_exposure_hash)[clazz.to_s] || []
  exposed_methods.each do |name, obj|
    options = obj[:options] || {}
    options[:cached] ? _add_cached_ctx_method(obj, name) : _add_ctx_method(obj, name)
  end
  @configured_exposed_context = true
end

#configured_exposed_context?Boolean

Returns:

  • (Boolean)


86
87
88
# File 'lib/context_exposer/base_controller.rb', line 86

def configured_exposed_context?
  @configured_exposed_context == true
end

#view_ctxObject Also known as: ctx



14
15
16
# File 'lib/context_exposer/base_controller.rb', line 14

def view_ctx
  @view_ctx ||= build_view_ctx
end