From 0a19d73d26bd0fc1931cbd9a3faaac53bad4293b Mon Sep 17 00:00:00 2001 From: elliottcable Date: Fri, 13 Mar 2009 10:41:13 -0400 Subject: [PATCH] Re-arranged `Window`.rb and added section headers --- lib/nfoiled/window.rb | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/lib/nfoiled/window.rb b/lib/nfoiled/window.rb index f02ba7a..e74debf 100644 --- a/lib/nfoiled/window.rb +++ b/lib/nfoiled/window.rb @@ -12,6 +12,10 @@ module Nfoiled def windows; Terminal.current.windows; end end + # ============== + # = Attributes = + # ============== + # The Y co-ordinate of the top left corner of this `Window`'s bounding box attr_reader :top # The X co-ordinate of the top left corner of this `Window`'s bounding box @@ -27,6 +31,10 @@ module Nfoiled # The `Terminal` that this `Window` pertains to attr_reader :owner + # ==================== + # = Setup / Teardown = + # ==================== + ## # Responsible for creating a new `Window`, this will also take care of # initializing Ncurses if necessary. @@ -43,6 +51,19 @@ module Nfoiled end ## + # Destroys the `wrapee` of this `Window`, and removes this `Window` + # from its owning `Terminal`'s `#windows`. + def destroy! + ::Ncurses.delwin(@wrapee) + @wrapee = nil + @owner.windows.delete self + end + + # ========== + # = Output = + # ========== + + ## # Prints a string to the window def print string @wrapee.printw string @@ -54,14 +75,5 @@ module Nfoiled def puts string self.print string.to_s + "\n" end - - ## - # Destroys the `wrapee` of this `Window`, and removes this `Window` - # from its owning `Terminal`'s `#windows`. - def destroy! - ::Ncurses.delwin(@wrapee) - @wrapee = nil - @owner.windows.delete self - end end end -- 2.11.4.GIT