Sha256: 887b8423dea6573f31bc1f8bcb80dcd51b53a9e0f038e7d40bf2ebfa68bf2ac6
Contents?: true
Size: 872 Bytes
Versions: 3
Compression:
Stored size: 872 Bytes
Contents
# The pretty_table extension adds Sequel::Dataset#print and the # Sequel::PrettyTable class for creating nice-looking plain-text # tables. Example: # # +--+-------+ # |id|name | # |--+-------| # |1 |fasdfas| # |2 |test | # +--+-------+ # # You can load this extension into specific datasets: # # ds = DB[:table] # ds.extension(:pretty_table) # # Or you can load it into all of a database's datasets, which # is probably the desired behavior if you are using this extension: # # DB.extension(:pretty_table) module Sequel extension :_pretty_table module DatasetPrinter # Pretty prints the records in the dataset as plain-text table. def print(*cols) ds = naked rows = ds.all Sequel::PrettyTable.print(rows, cols.empty? ? ds.columns : cols) end end Dataset.register_extension(:pretty_table, DatasetPrinter) end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sequel-4.1.1 | lib/sequel/extensions/pretty_table.rb |
sequel-4.1.0 | lib/sequel/extensions/pretty_table.rb |
sequel-4.0.0 | lib/sequel/extensions/pretty_table.rb |