Class: Paru::PandocFilter::Cell
- Defined in:
- lib/paru/filter/cell.rb
Overview
A Cell node represents a cell in a table’s head, body, or foot.
Instance Attribute Summary collapse
-
#alignment ⇒ Object
AlignCenter, or AlignDefault.
-
#attr ⇒ Object
Attr.
-
#colspan ⇒ Object
Value containing an Integer.
-
#rowspan ⇒ Object
Value containing an Integer.
Instance Method Summary collapse
-
#ast_contents ⇒ Array
The AST contents of this Cell.
-
#initialize(contents) ⇒ Cell
constructor
Create a new Cell based on the row_data.
-
#to_ast ⇒ Hash
Create an AST representation of this Node.
Constructor Details
#initialize(contents) ⇒ Cell
Create a new Cell based on the row_data
47 48 49 50 51 52 53 54 |
# File 'lib/paru/filter/cell.rb', line 47 def initialize(contents) @attr = Attr.new contents[0] @alignment = Value.new contents[1] @rowspan = IntValue.new contents[2] @colspan = IntValue.new contents[3] super(contents[4]) end |
Instance Attribute Details
#alignment ⇒ Object
AlignCenter, or AlignDefault.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/paru/filter/cell.rb', line 41 class Cell < Block attr_accessor :attr, :alignment, :rowspan, :colspan # Create a new Cell based on the row_data # # @param contents [Array] def initialize(contents) @attr = Attr.new contents[0] @alignment = Value.new contents[1] @rowspan = IntValue.new contents[2] @colspan = IntValue.new contents[3] super(contents[4]) end # The AST contents of this Cell # # @return [Array] def ast_contents [ @attr.to_ast, @alignment.to_ast, @rowspan.to_ast, @colspan.to_ast, @children.map(&:to_ast) ] end # Create an AST representation of this Node # # @return [Hash] def to_ast ast_contents end end |
#attr ⇒ Object
Returns Attr.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/paru/filter/cell.rb', line 41 class Cell < Block attr_accessor :attr, :alignment, :rowspan, :colspan # Create a new Cell based on the row_data # # @param contents [Array] def initialize(contents) @attr = Attr.new contents[0] @alignment = Value.new contents[1] @rowspan = IntValue.new contents[2] @colspan = IntValue.new contents[3] super(contents[4]) end # The AST contents of this Cell # # @return [Array] def ast_contents [ @attr.to_ast, @alignment.to_ast, @rowspan.to_ast, @colspan.to_ast, @children.map(&:to_ast) ] end # Create an AST representation of this Node # # @return [Hash] def to_ast ast_contents end end |
#colspan ⇒ Object
Returns Value containing an Integer.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/paru/filter/cell.rb', line 41 class Cell < Block attr_accessor :attr, :alignment, :rowspan, :colspan # Create a new Cell based on the row_data # # @param contents [Array] def initialize(contents) @attr = Attr.new contents[0] @alignment = Value.new contents[1] @rowspan = IntValue.new contents[2] @colspan = IntValue.new contents[3] super(contents[4]) end # The AST contents of this Cell # # @return [Array] def ast_contents [ @attr.to_ast, @alignment.to_ast, @rowspan.to_ast, @colspan.to_ast, @children.map(&:to_ast) ] end # Create an AST representation of this Node # # @return [Hash] def to_ast ast_contents end end |
#rowspan ⇒ Object
Returns Value containing an Integer.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/paru/filter/cell.rb', line 41 class Cell < Block attr_accessor :attr, :alignment, :rowspan, :colspan # Create a new Cell based on the row_data # # @param contents [Array] def initialize(contents) @attr = Attr.new contents[0] @alignment = Value.new contents[1] @rowspan = IntValue.new contents[2] @colspan = IntValue.new contents[3] super(contents[4]) end # The AST contents of this Cell # # @return [Array] def ast_contents [ @attr.to_ast, @alignment.to_ast, @rowspan.to_ast, @colspan.to_ast, @children.map(&:to_ast) ] end # Create an AST representation of this Node # # @return [Hash] def to_ast ast_contents end end |
Instance Method Details
#ast_contents ⇒ Array
The AST contents of this Cell
59 60 61 62 63 64 65 66 67 |
# File 'lib/paru/filter/cell.rb', line 59 def ast_contents [ @attr.to_ast, @alignment.to_ast, @rowspan.to_ast, @colspan.to_ast, @children.map(&:to_ast) ] end |
#to_ast ⇒ Hash
Create an AST representation of this Node
72 73 74 |
# File 'lib/paru/filter/cell.rb', line 72 def to_ast ast_contents end |