Class: HammerBuilder::Formatted

Inherits:
Standard show all
Defined in:
lib/hammer_builder/formatted.rb

Overview

Builder implementation with formatting (indented by ‘ ’) Slow down is less then 1%

Instance Attribute Summary

Attributes inherited from Abstract

#_current

Instance Method Summary collapse

Methods inherited from Abstract

#cdata, #flush, #go_in, #html5, #initialize, #join, #js, #raw, #render, #reset, #set_variables, #text, #to_html

Methods included from DynamicClasses

#dynamic_classes, extended, #inherited

Constructor Details

This class inherits a constructor from HammerBuilder::Abstract

Instance Method Details

#comment(comment) ⇒ Object



37
38
39
40
41
# File 'lib/hammer_builder/formatted.rb', line 37

def comment(comment)
  flush
  @_output << Strings::NEWLINE << Strings::SPACES.fetch(@_stack.size, Strings::SPACE) << Strings::COMMENT_START <<
      comment.to_s << Strings::COMMENT_END
end