Module: TemplateStreaming::Response

Defined in:
lib/template_streaming.rb

Overview

Only prepare once.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



177
178
179
180
# File 'lib/template_streaming.rb', line 177

def self.included(base)
  base.alias_method_chain :prepare!, :template_streaming
  base.alias_method_chain :set_content_length!, :template_streaming
end

Instance Method Details

#prepare_with_template_streaming!Object



182
183
184
185
186
# File 'lib/template_streaming.rb', line 182

def prepare_with_template_streaming!
  return if defined?(@prepared)
  prepare_without_template_streaming!
  @prepared = true
end

#set_content_length_with_template_streaming!Object



188
189
190
191
192
193
194
# File 'lib/template_streaming.rb', line 188

def set_content_length_with_template_streaming!
  if body.is_a?(StreamingBody)
    # pass
  else
    set_content_length_without_template_streaming!
  end
end