Class | Haml::Buffer |
In: |
lib/haml/buffer.rb
lib/haml/template/plugin.rb |
Parent: | Object |
This class is used only internally. It holds the buffer of HTML that is eventually output as the resulting document. It‘s called from within the precompiled code, and helps reduce the amount of processing done within `instance_eval`ed code.
active | [W] | @return [Boolean] @see active? |
buffer | [RW] |
The string that holds the compiled HTML. This is
aliased as `_erbout` for compatibility with ERB-specific code.
@return [String] |
capture_position | [RW] |
nil if there‘s no capture_haml block running, and the position at
which it‘s beginning the capture if there is one.
@return [Fixnum, nil] |
options | [RW] |
The options hash passed in from {Haml::Engine}.
@return [{String => Object}] @see Haml::Engine#options_for_buffer |
upper | [RW] |
The {Buffer} for the enclosing Haml document. This is set for partials and similar
sorts of nested templates. It‘s `nil` at the top level (see
\{toplevel?}).
@return [Buffer] |
Merges two attribute hashes. This is the same as `to.merge!(from)`, except that it merges id, class, and data attributes.
ids are concatenated with `"_"`, and classes are concatenated with `" "`. data hashes are simply merged.
Destructively modifies both `to` and `from`.
@param to [{String => String}] The attribute hash to merge into @param from [{String => to_s}] The attribute hash to merge from @return [{String => String}] `to`, after being merged
Whether or not this buffer is currently being used to render a Haml template. Returns `false` if a subtemplate is being rendered, even if it‘s a subtemplate of this buffer‘s template.
@return [Boolean]
Modifies the indentation of the document.
@param tab_change [Fixnum] The number of tabs by which to increase
or decrease the document's indentation
Takes the various information about the opening tag for an element, formats it, and appends it to the buffer.
Appends text to the buffer, properly tabulated. Also modifies the document‘s indentation.
@param text [String] The text to append @param tab_change [Fixnum] The number of tabs by which to increase
or decrease the document's indentation
@param dont_tab_up [Boolean] If true, don‘t indent the first line of `text`
Remove the whitespace from the right side of the buffer string. Doesn‘t do anything if we‘re at the beginning of a capture_haml block.
Sets the current tabulation of the document.
@param val [Fixnum] The new tabulation