Module: Slotify::Extensions::Base

Extended by:
HelpersConcern
Defined in:
lib/slotify/extensions/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HelpersConcern

make_compatible_with_slots

Instance Attribute Details

#partialObject (readonly)

Returns the value of attribute partial.



6
7
8
# File 'lib/slotify/extensions/base.rb', line 6

def partial
  @partial
end

Instance Method Details

#_layout_for(*args, &block) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/slotify/extensions/base.rb', line 15

def _layout_for(*args, &block)
  if block && args.first.is_a?(Symbol)
    capture_with_outer_partial_access(*args, &block)
  else
    super
  end
end

#capture_with_outer_partial_access(*args, &block) ⇒ Object



23
24
25
26
27
28
# File 'lib/slotify/extensions/base.rb', line 23

def capture_with_outer_partial_access(*args, &block)
  inner_partial, @partial = partial, partial.outer_partial
  inner_partial.capture(*args, &block)
ensure
  @partial = inner_partial
end

#render(target = {}, locals = {}, &block) ⇒ Object



8
9
10
11
12
13
# File 'lib/slotify/extensions/base.rb', line 8

def render(target = {}, locals = {}, &block)
  @partial = Slotify::Partial.new(self)
  super
ensure
  @partial = partial.outer_partial
end