Class: HammerBuilder::StubBuilderForDocumentation::AbstractDoubleTag
- Inherits:
-
AbstractTag
- Object
- AbstractTag
- HammerBuilder::StubBuilderForDocumentation::AbstractDoubleTag
- Defined in:
- lib/hammer_builder/doc.rb
Constant Summary
Constant Summary
Constants inherited from AbstractTag
HammerBuilder::StubBuilderForDocumentation::AbstractTag::METHOD_MISSING_REGEXP
Instance Attribute Summary
Attributes inherited from AbstractTag
Class Method Summary (collapse)
- + (Object) define_attribute_method(attribute) protected private
Instance Method Summary (collapse)
-
- (Object) content(content)
sets content of the double tag.
-
- (Object) flush
private
closes the tag.
-
- (Object) with { ... }
(also: #w)
renders content of the double tag with block.
Methods inherited from AbstractTag
add_attributes, #attribute, attribute_content_rendering, attributes, #attributes, #class, #data, #default, define_attribute_methods, #flush_classes, #id, inherited, #initialize, #mimic, #open, #rclass, set_tag, tag_name
Constructor Details
This class inherits a constructor from HammerBuilder::StubBuilderForDocumentation::AbstractTag
Class Method Details
+ (Object) define_attribute_method(attribute) (protected)
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.
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
# File 'lib/hammer_builder/doc.rb', line 361 def self.define_attribute_method(attribute) return if instance_methods(false).include?(attribute.name) name = attribute.name.to_s if instance_methods.include?(attribute.name) class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{name}(*args, &block) super(*args, &nil) return with(&block) if block self end RUBY else content_rendering = attribute_content_rendering(attribute) class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{name}(content#{' = true' if attribute.type == :boolean}, &block) #{content_rendering} return with(&block) if block self end RUBY end end |
Instance Method Details
- (Object) content(content)
sets content of the double tag
304 305 306 307 |
# File 'lib/hammer_builder/doc.rb', line 304 def content(content) @content = content.to_s self end |
- (Object) flush
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
291 292 293 294 295 296 297 |
# File 'lib/hammer_builder/doc.rb', line 291 def flush flush_classes @output << Strings::GT @output << CGI.escapeHTML(@content) if @content @output << Strings::SLASH_LT << @stack.pop << Strings::GT @content = nil end |
- (Object) with { ... } Also known as: w
renders content of the double tag with block
316 317 318 319 320 321 322 323 324 325 326 327 328 |
# File 'lib/hammer_builder/doc.rb', line 316 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 |