From 62cd9c357ae0268fb6685cd16d381d0d92b9a879 Mon Sep 17 00:00:00 2001 From: Ysiad Ferreiras Date: Sun, 5 Jun 2011 19:28:28 -0700 Subject: [PATCH] adding documentation for current_group and fill_breakable --- lib/prettyprint.rb | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/lib/prettyprint.rb b/lib/prettyprint.rb index 2c1fff3..a28cf92 100644 --- a/lib/prettyprint.rb +++ b/lib/prettyprint.rb @@ -93,6 +93,7 @@ class PrettyPrint attr_reader :output, :maxwidth, :newline, :genspace attr_reader :indent, :group_queue + # current_group returns the group most recently added to the stack. def current_group @group_stack.last end @@ -119,6 +120,9 @@ class PrettyPrint current_group.first? end + # break_outmost_groups breaks the buffer into + # lines that are shorter than the maxwidth specified + # in this instance. def break_outmost_groups while @maxwidth < @output_width + @buffer_width return unless group = @group_queue.deq @@ -155,6 +159,8 @@ class PrettyPrint end end + # fill_breakable is a convenience method for breakable. + # It is identical to calling breakable with the same parameters. def fill_breakable(sep=' ', width=sep.length) group { breakable sep, width } end -- 1.7.3.1