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
45 46 47 48 49 50 51 52 |
# File 'lib/paru/filter/cell.rb', line 45 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.
39 40 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 |
# File 'lib/paru/filter/cell.rb', line 39 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 {|child| child.to_ast} ] end # Create an AST representation of this Node # # @return [Hash] def to_ast() ast_contents() end end |
#attr ⇒ Object
Returns Attr.
39 40 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 |
# File 'lib/paru/filter/cell.rb', line 39 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 {|child| child.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.
39 40 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 |
# File 'lib/paru/filter/cell.rb', line 39 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 {|child| child.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.
39 40 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 |
# File 'lib/paru/filter/cell.rb', line 39 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 {|child| child.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
57 58 59 60 61 62 63 64 65 |
# File 'lib/paru/filter/cell.rb', line 57 def ast_contents [ @attr.to_ast, @alignment.to_ast, @rowspan.to_ast, @colspan.to_ast, @children.map {|child| child.to_ast} ] end |
#to_ast ⇒ Hash
Create an AST representation of this Node
70 71 72 |
# File 'lib/paru/filter/cell.rb', line 70 def to_ast() ast_contents() end |