Module: Ariadne::Forms::ActsAsComponent::InstanceMethods

Defined in:
lib/ariadne/forms/acts_as_component.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#before_renderObject

:nocov:



36
# File 'lib/ariadne/forms/acts_as_component.rb', line 36

def before_render; end

#capture(*args, &block) ⇒ Object

This is necessary to restore the functionality changed by github.com/rails/rails/pull/47194. I would love to remove this at some point, perhaps if we ever decide to replace ActsAsComponent with view component.



22
23
24
25
26
27
28
# File 'lib/ariadne/forms/acts_as_component.rb', line 22

def capture(*args, &block)
  old_buffer = @view_context.output_buffer
  @view_context.output_buffer = ActionView::OutputBuffer.new
  @view_context.capture(*args, &block)
ensure
  @view_context.output_buffer = old_buffer
end

#perform_render(&_block) ⇒ Object

:nocov:

Raises:

  • (NotImplementedError)


31
32
33
# File 'lib/ariadne/forms/acts_as_component.rb', line 31

def perform_render(&_block)
  raise NotImplementedError, "subclasses must implement ##{__method__}."
end

#render_in(view_context, &block) ⇒ Object



13
14
15
16
17
# File 'lib/ariadne/forms/acts_as_component.rb', line 13

def render_in(view_context, &block)
  @view_context = view_context
  before_render
  perform_render(&block)
end

#set_original_view_context(view_context) ⇒ Object

:nocov:



39
40
41
# File 'lib/ariadne/forms/acts_as_component.rb', line 39

def set_original_view_context(view_context)
  @view_context = view_context
end