lib/core/facets/string/align.rb in facets-2.8.4 vs lib/core/facets/string/align.rb in facets-2.9.0.pre.1
- old
+ new
@@ -1,7 +1,25 @@
class String
+ # Alignment method dispatches to #align_right, #align_left
+ # or #align_center, accorging to the first +direction+ parameter.
+ #
+ # s = <<-EOS
+ # This is a test
+ # and
+ # so on
+ # EOS
+ #
+ # s.align(:right, 14)
+ #
+ # _produces_ ...
+ #
+ # This is a test
+ # and
+ # so on
+ #
+ # Returns a String aligned right, left or center.
def align(direction, n, sep="\n", c=' ')
case direction
when :right
align_right(n, sep="\n", c=' ')
when :left
@@ -23,13 +41,13 @@
# This is a test
# and
# so on
# EOS
#
- # puts s.align_right(14)
+ # s.align_right(14)
#
- # _produces_
+ # _produces_ ...
#
# This is a test
# and
# so on
#
@@ -53,13 +71,13 @@
# This is a test
# and
# so on
# EOS
#
- # puts s.align_left(20, "\n", '.')
+ # s.align_left(20, "\n", '.')
#
- # _produces_
+ # _produces_ ...
#
# This is a test......
# and.................
# so on...............
#
@@ -83,12 +101,12 @@
# This is a test
# and
# so on
# EOS
#
- # puts s.align_center(14)
+ # s.align_center(14)
#
- # _produces_
+ # _produces_ ...
#
# This is a test
# and
# so on
#