Skip to content
This repository
Browse code

columnize.rb: some module function text got bolixed. Makefile: allow …

…specifying which rake
  • Loading branch information...
commit 1a1c2839579ba2254b1572fd0f7086e3368f8f8d 1 parent d11ed04
R. Bernstein authored

Showing 2 changed files with 14 additions and 5 deletions. Show diff stats Hide diff stats

  1. +5 1 Makefile
  2. +9 4 lib/columnize.rb
6 Makefile
... ... @@ -1,5 +1,9 @@
1 1 # I'll admit it -- I'm an absent-minded old-timer who has trouble
2 2 # learning new tricks.
  3 +
  4 +RUBY ?= ruby
  5 +RAKE ?= rake
  6 +
3 7 test: check
4 8
5 9 #: Default target; same as "make check"
@@ -8,4 +12,4 @@ all: check
8 12
9 13 #: Same as corresponding rake task
10 14 %:
11   - rake $@
  15 + $(RAKE) $@
13 lib/columnize.rb
@@ -110,18 +110,23 @@ def cell_size(cell, term_adjust)
110 110 end.size
111 111 end
112 112
113   - # For example, for a line width of 4 characters (arranged vertically):
  113 + # columize([args]) => String
  114 + #
  115 + # Return a string from an array with embedded newlines formatted so
  116 + # that when printed the columns are aligned.
  117 + #
  118 + # For example, for a line width of 4 characters (arranged vertically):
114 119 # a = (1..4).to_a
115 120 # Columnize.columnize(a) => '1 3\n2 4\n'
116 121 #
117   - # Alternatively:
  122 + # Alternatively:
118 123 # a.columnize => '1 3\n2 4\n'
119 124 #
120   - # Arranged horizontally:
  125 + # Arranged horizontally:
121 126 # a.columnize(:arrange_vertical => false) =>
122 127 # ['1', '2,', '3', '4'] => '1 2\n3 4\n'
123 128 #
124   - # Formatted as an array using format specifier '%02d':
  129 + # Formatted as an array using format specifier '%02d':
125 130 # puts (1..10).to_a.columnize(:arrange_array => true, :colfmt => '%02d',
126 131 # :displaywidth => 10) =>
127 132 # [01, 02,

0 comments on commit 1a1c283

Please sign in to comment.
Something went wrong with that request. Please try again.