class Paru::PandocFilter::ColSpec
ColSpec
represents a colspec definition for a table column. It contains an alignment and the column’s width.
@see hackage.haskell.org/package/pandoc-types-1.21/docs/Text-Pandoc-Definition.html#t:ColSpec
@!attribute alignment
@return [String]
@!attribute width
@return [Double|COL_WIDTH_DEFAULT]
Attributes
Public Class Methods
Source
# File lib/paru/filter/col_spec.rb, line 48 def initialize(contents = DEFAULT_COLSPEC) @alignment = Value.new contents[0] @width = Value.new contents[1] end
Create a new ColSpec
object
@param contents [Array = DEFAULT_COLSPEC] the attributes as a pair of [alignment, width]
Public Instance Methods
Source
# File lib/paru/filter/col_spec.rb, line 68 def alignment=(new_alignment) @alignment.value = new_alignment end
Set the alignment
@param [String] new_alignment the new alignment.
Source
# File lib/paru/filter/col_spec.rb, line 76 def to_ast [ @alignment.to_ast, @width.to_ast ] end
Convert this attributes object to an AST representation
@return [Array] Array containing id, class name list, and
key-value pair list
Source
# File lib/paru/filter/col_spec.rb, line 57 def width=(new_width) if new_width == "ColWidthDefault" then @width = Value.new({"t" => new_width}) else @width = Value.new({"t" => "ColWidth", "c" => new_width}) end end
Set the width
@param [String|Integer|Float] new_width the new width. If it is “ColWidthDefault”, it uses the default value.