Module: HamlAssets::HamlSprocketsEngine::ViewContext

Defined in:
lib/haml_assets/haml_sprockets_engine.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#output_bufferObject

Returns the value of attribute output_buffer.



11
12
13
# File 'lib/haml_assets/haml_sprockets_engine.rb', line 11

def output_buffer
  @output_buffer
end

Class Method Details

.included(klass) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/haml_assets/haml_sprockets_engine.rb', line 28

def self.included(klass)
  klass.instance_eval do
    include Rails.application.routes.url_helpers
    include Rails.application.routes.mounted_helpers
    include ActionView::Helpers

    alias_method :output_buffer_without_haml, :output_buffer
    alias_method :output_buffer, :output_buffer_with_haml

    alias_method :set_output_buffer_without_haml, :output_buffer=
    alias_method :output_buffer=, :set_output_buffer_with_haml
  end
end

Instance Method Details

#output_buffer_with_hamlObject



13
14
15
16
# File 'lib/haml_assets/haml_sprockets_engine.rb', line 13

def output_buffer_with_haml
  return haml_buffer.buffer if is_haml?
  output_buffer_without_haml
end

#protect_against_forgery?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/haml_assets/haml_sprockets_engine.rb', line 42

def protect_against_forgery?
  false
end

#set_output_buffer_with_haml(new) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/haml_assets/haml_sprockets_engine.rb', line 18

def set_output_buffer_with_haml(new)
  if is_haml?
    new = String.new(new) if Haml::Util.rails_xss_safe? &&
      new.is_a?(Haml::Util.rails_safe_buffer_class)
    haml_buffer.buffer = new
  else
    set_output_buffer_without_haml new
  end
end