Sha256: 0459947eab4440ec1bc3aa27622375855ce13f5a81fd1374bdfafae5bf17c975

Contents?: true

Size: 996 Bytes

Versions: 14

Compression:

Stored size: 996 Bytes

Contents

# frozen_string_literal: true
##
# A section of table

class RDoc::Markup::Table
  attr_accessor :header, :align, :body

  def initialize header, align, body
    @header, @align, @body = header, align, body
  end

  def == other
    self.class == other.class and
      @header == other.header and
      @align == other.align and
      @body == other.body
  end

  def accept visitor
    visitor.accept_table @header, @body, @align
  end

  def pretty_print q # :nodoc:
    q.group 2, '[Table: ', ']' do
      q.group 2, '[Head: ', ']' do
        q.seplist @header.zip(@align) do |text, align|
          q.pp text
          if align
            q.text ":"
            q.breakable
            q.text align.to_s
          end
        end
      end
      q.breakable
      q.group 2, '[Body: ', ']' do
        q.seplist @body do |body|
          q.group 2, '[', ']' do
            q.seplist body do |text|
              q.pp text
            end
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 4 rubygems

Version Path
rdoc-6.5.1.1 lib/rdoc/markup/table.rb
rdoc-6.4.1.1 lib/rdoc/markup/table.rb
rdoc-6.3.4.1 lib/rdoc/markup/table.rb
rdoc-6.6.1 lib/rdoc/markup/table.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/rdoc-6.6.0/lib/rdoc/markup/table.rb
rdoc-6.6.0 lib/rdoc/markup/table.rb
rdoc-6.5.0 lib/rdoc/markup/table.rb
ric-0.14.2 vendor/bundle/ruby/2.7.0/gems/rdoc-6.4.0/lib/rdoc/markup/table.rb
ric-0.14.1 vendor/bundle/ruby/2.7.0/gems/rdoc-6.4.0/lib/rdoc/markup/table.rb
ric-0.14.0 vendor/bundle/ruby/2.7.0/gems/rdoc-6.4.0/lib/rdoc/markup/table.rb
rdoc-6.4.0 lib/rdoc/markup/table.rb
rdoc-6.3.3 lib/rdoc/markup/table.rb
rdoc-6.3.2 lib/rdoc/markup/table.rb
gitlab-rdoc-6.3.2 lib/rdoc/markup/table.rb