Sha256: 7bea838038271112592c984db24bdd2b4bc131f7b014601d96ace6d8b7f41c19

Contents?: true

Size: 705 Bytes

Versions: 2

Compression:

Stored size: 705 Bytes

Contents

require 'clio/layout'

module Clio

  class Layout

    # = Table
    #
    # Currently the table layout class is very
    # simplistic. Ultimately it will support
    # headers, footers, and a varity of border
    # options.
    class Table < Layout

      attr :rows

      def initialize(*rows_of_cells, &block)
        @rows = rows_of_cells
      end

      def row(*cells, &block)
        @rows << cells
        instance_eval(&block)
      end

      def cell(acell)
        (@rows.last ||= []) << acell
      end

      def to_s
        #screen_width
        rows.collect{ |cells|
          cells.join(' ')
        }.join("\n")
      end

      ###
      #class Row
      #end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
clio-0.2.0 lib/clio/layout/table.rb
clio-0.3.0 lib/clio/layout/table.rb