~ubuntu-branches/ubuntu/vivid/ruby-sequel/vivid

« back to all changes in this revision

Viewing changes to lib/sequel/extensions/pretty_table.rb

  • Committer: Package Import Robot
  • Author(s): Dmitry Borodaenko, Dmitry Borodaenko, Cédric Boutillier
  • Date: 2013-08-10 18:38:17 UTC
  • mfrom: (1.1.8)
  • Revision ID: package-import@ubuntu.com-20130810183817-iqanz804j32i5myi
Tags: 4.1.1-1
[ Dmitry Borodaenko ]
* New upstream release.
* Standards-Version upgraded to 3.9.4 (no changes).
* Added Build-Depend on ruby-sqlite3.

[ Cédric Boutillier ]
* debian/control: remove obsolete DM-Upload-Allowed flag.
* use canonical URI in Vcs-* fields.
* debian/copyright: use DEP5 copyright-format/1.0 official URL for Format
  field.
* Update debian/watch. Thanks Bart Martens.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
#   |2 |test   |
10
10
#   +--+-------+
11
11
#
12
 
# To load the extension:
13
 
#
14
 
#   Sequel.extension :pretty_table
 
12
# You can load this extension into specific datasets:
 
13
#
 
14
#   ds = DB[:table]
 
15
#   ds.extension(:pretty_table)
 
16
#
 
17
# Or you can load it into all of a database's datasets, which
 
18
# is probably the desired behavior if you are using this extension:
 
19
#
 
20
#   DB.extension(:pretty_table)
15
21
 
16
22
module Sequel
17
23
  extension :_pretty_table
18
24
 
19
 
  class Dataset
 
25
  module DatasetPrinter
20
26
    # Pretty prints the records in the dataset as plain-text table.
21
27
    def print(*cols)
22
28
      ds = naked
24
30
      Sequel::PrettyTable.print(rows, cols.empty? ? ds.columns : cols)
25
31
    end
26
32
  end
 
33
 
 
34
  Dataset.register_extension(:pretty_table, DatasetPrinter)
27
35
end