Class Texy::BlockElement
In: lib/texy/dom.rb
Parent: HtmlElement

This element represent array of other blocks (HtmlElement)

Methods

Public Class methods

[Source]

# File lib/texy/dom.rb, line 136
        def initialize(texy)
            super
            @children = []
        end

Public Instance methods

child must be BlockElement or TextualElement

[Source]

# File lib/texy/dom.rb, line 142
        def append_child(child)
            @children << [@children.size, child]

            self.content_type = [self.content_type, child.content_type].max
        end

[Source]

# File lib/texy/dom.rb, line 148
        def child_at(key)
            @children.find do |item|
                item[0] == key
            end[1] rescue nil
        end

Parse text as BLOCK and create array of children (array of Texy DOM elements)

[Source]

# File lib/texy/dom.rb, line 165
            def parse(text)
                parser = BlockParser.new(self)
                parser.parse(text)
            end

Protected Instance methods

[Source]

# File lib/texy/dom.rb, line 172
            def broadcast
                super

                # apply to all children
                @children.map do |(key, child)|
                    child.broadcast
                end
            end

[Source]

# File lib/texy/dom.rb, line 156
            def generate_content
                @children.inject('') do |html, child|
                    html + child[1].to_html
                end
            end

[Validate]