Class: HammerBuilder::StubBuilderForDocumentation::AbstractDoubleTag

Inherits:
AbstractTag
  • Object
show all
Defined in:
lib/hammer_builder/doc.rb

Constant Summary

Constants inherited from AbstractTag

HammerBuilder::StubBuilderForDocumentation::AbstractTag::METHOD_MISSING_REGEXP

Instance Attribute Summary

Attributes inherited from AbstractTag

#builder

Instance Method Summary collapse

Methods inherited from AbstractTag

#attribute, attributes, #attributes, #class, #data, #id, #initialize, #mimic, #open, #rclass, tag_name

Constructor Details

This class inherits a constructor from HammerBuilder::StubBuilderForDocumentation::AbstractTag

Instance Method Details

#content(content) ⇒ Object

sets content of the double tag

Examples:

div 'content' # => <div>content</div>
div.content 'content' # => <div>content</div>
div :content => 'content' # => <div>content</div>


303
304
305
306
# File 'lib/hammer_builder/doc.rb', line 303

def content(content)
  @content = content.to_s
  self
end

#flushObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

closes the tag



290
291
292
293
294
295
296
# File 'lib/hammer_builder/doc.rb', line 290

def flush
  flush_classes
  @output << Strings::GT
  @output << CGI.escapeHTML(@content) if @content
  @output << Strings::SLASH_LT << @stack.pop << Strings::GT
  @content = nil
end

#with { ... } ⇒ Object Also known as: w

renders content of the double tag with block

Examples:

div { text 'content' } # => <div>content</div>
div :id => 'id' do
  text 'content'
end # => <div id="id">content</div>

Yields:

  • content of the tag



315
316
317
318
319
320
321
322
323
324
325
326
327
# File 'lib/hammer_builder/doc.rb', line 315

def with
  flush_classes
  @output << Strings::GT
  @content         = nil
  @builder.current = nil
  yield
  #if (content = yield).is_a?(String)
  #  @output << EscapeUtils.escape_html(content)
  #end
  @builder.flush
  @output << Strings::SLASH_LT << @stack.pop << Strings::GT
  nil
end