Sha256: 761b0010438d3ee908be942366c5826ff3d1056be54455386658228558e54149
Contents?: true
Size: 843 Bytes
Versions: 1
Compression:
Stored size: 843 Bytes
Contents
module PaginatedTable class TableDescription attr_reader :columns, :rows def initialize(description_proc = nil) @columns = [] @rows = [] description_proc.call(self) if description_proc end def row(options = {}, &block) @explicit_rows = true create_row(options, block) end def column(*args, &block) raise Invalid if @explicit_rows default_row.column(*args, &block) end def colspan(span) raise ArgumentError unless span == :all rows.map { |row| row.columns.length }.max.to_s end private def default_row @default_row ||= create_row end def create_row(options = {}, block = nil) row = RowDescription.new(self, options, block) @rows << row row end class Invalid < StandardError end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
paginated_table-0.0.8 | lib/paginated_table/table_description.rb |