module Cell::Hamlit

Constants

VERSION

Public Class Methods

included(base) click to toggle source
# File lib/cell/hamlit.rb, line 5
def self.included(base)
  begin
    require "hamlit/rails_helpers"
  rescue LoadError
  else
    base.include ::Hamlit::RailsHelpers
  end
end

Public Instance Methods

capture(*args) { |*args| ... } click to toggle source
# File lib/cell/hamlit.rb, line 43
def capture(*args)
  value = nil
  buffer = with_output_buffer { value = yield(*args) }
  if buffer.size > 0
    buffer.to_s
  else
    value
  end
end
content_tag(name, content_or_options_with_block=nil, options=nil, escape=false, &block) click to toggle source

def form_for(*args, &block) # TODO: remove this once Haml 4.1 is out. the form_for_with_haml is buggy.

form_for_without_haml(*args, &block)

end

Calls superclass method
# File lib/cell/hamlit.rb, line 70
def content_tag(name, content_or_options_with_block=nil, options=nil, escape=false, &block)
  super
end
form_tag_in_block(html_options, &block) click to toggle source

From FormTagHelper. why do they escape every possible string? why?

# File lib/cell/hamlit.rb, line 26
def form_tag_in_block(html_options, &block)
  content = capture(&block)
  form_tag_with_body(html_options, content)
end
form_tag_with_body(html_options, content) click to toggle source
# File lib/cell/hamlit.rb, line 31
def form_tag_with_body(html_options, content)
  "#{form_tag_html(html_options)}" << content.to_s << "</form>"
end
render_template(*) click to toggle source
Calls superclass method
# File lib/cell/hamlit.rb, line 53
def render_template(*)
  @output_buffer ||= nil # suppress uninitialized instance variable warning
  old_output_buffer = @output_buffer
  super
ensure
  @output_buffer = old_output_buffer
end
template_options_for(options) click to toggle source
# File lib/cell/hamlit.rb, line 14
def template_options_for(options)
  {
    escape_html:    false,
    template_class: ::Hamlit::Template,
    suffix:         "haml",
    buffer:         '@output_buffer',
  }
end
with_output_buffer(block_buffer=ViewModel::OutputBuffer.new) { || ... } click to toggle source
# File lib/cell/hamlit.rb, line 35
def with_output_buffer(block_buffer=ViewModel::OutputBuffer.new)
  @output_buffer, old_buffer = block_buffer, @output_buffer
  yield
  block_buffer
ensure
  @output_buffer = old_buffer
end