Module: DecentExposure

Defined in:
lib/contextualize/decent_exposure.rb

Instance Method Summary collapse

Instance Method Details

#expose(name, &block) ⇒ Object Also known as: view_expose



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/contextualize/decent_exposure.rb', line 2

def expose(name, &block)
  closured_exposure = default_exposure
  define_method name do
    @_resources       ||= {}
    @_resources[name] ||= if block_given?
      instance_eval(&block)
    else
      instance_exec(name, &closured_exposure)
    end
    @_resources[name].add_context :view
  end
  helper_method name
  hide_action name
end