class HTML::Table::Caption
This class represents an HTML
Caption
. Despite the name, it is not a subclass of Table
. Note that end tags for this class are mandatory.
Public Class Methods
indent_level()
click to toggle source
Returns the number of spaces that tags for this class are indented. For the Table::Caption
class, the indention level defaults to 3.
# File lib/html/caption.rb, line 36 def self.indent_level @indent_level end
indent_level=(num)
click to toggle source
Sets the number of spaces that tags for this class are indented.
# File lib/html/caption.rb, line 42 def self.indent_level=(num) expect(num, Integer) raise ArgumentError, 'indent level must be >= 0' if num < 0 @indent_level = num end
new(arg = nil, &block)
click to toggle source
Returns a new Table::Caption
object. Optionally takes a block. If an argument is provided it is treated as content.
# File lib/html/caption.rb, line 18 def initialize(arg = nil, &block) @html_begin = '<caption' @html_body = '' @html_end = '</caption>' instance_eval(&block) if block_given? self.content = arg if arg end
Public Instance Methods
content=(arg)
click to toggle source
Adds content to the Table::Caption
object.
# File lib/html/caption.rb, line 28 def content=(arg) arg = arg.is_a?(Array) ? arg.join : arg.to_s @html_body = Table::Content.new(arg) end