Module: Phlex::Rails::SGML::State

Defined in:
lib/phlex/rails/sgml/state.rb

Instance Method Summary collapse

Instance Method Details

#bufferObject



4
5
6
# File 'lib/phlex/rails/sgml/state.rb', line 4

def buffer
  @user_context[:capture_context]&.output_buffer&.raw_buffer || super
end

#captureObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/phlex/rails/sgml/state.rb', line 8

def capture
  if (capture_context = @user_context[:capture_context])
    original_capturing = @capturing
    original_fragments = @fragments

    capture_context.capture do
      @capturing = true
      @fragments = nil
      yield
    ensure
      @capturing = original_capturing
      @fragments = original_fragments
    end || ""
  else
    super
  end
end