Module: ActiveDecorator::ViewContext

Defined in:
lib/active_decorator/view_context.rb

Defined Under Namespace

Modules: Filter

Class Method Summary collapse

Class Method Details

.currentObject



7
8
9
# File 'lib/active_decorator/view_context.rb', line 7

def current
  view_context_stack.last
end

.popObject



15
16
17
# File 'lib/active_decorator/view_context.rb', line 15

def pop
  view_context_stack.pop
end

.push(view_context) ⇒ Object



11
12
13
# File 'lib/active_decorator/view_context.rb', line 11

def push(view_context)
  view_context_stack.push view_context
end

.run_with(view_context) ⇒ Object



23
24
25
26
27
28
# File 'lib/active_decorator/view_context.rb', line 23

def run_with(view_context)
  push view_context
  yield
ensure
  pop
end

.view_context_stackObject



19
20
21
# File 'lib/active_decorator/view_context.rb', line 19

def view_context_stack
  Thread.current[:active_decorator_view_contexts] ||= []
end