From d4d07e848483082e4bc91f4ab819fc86110d57dc Mon Sep 17 00:00:00 2001 From: elliottcable Date: Sun, 8 Mar 2009 13:14:14 -0800 Subject: [PATCH] Cleaned up `Window#initialize` --- lib/nfoiled/window.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/nfoiled/window.rb b/lib/nfoiled/window.rb index e5c52ce..fd9c5cf 100644 --- a/lib/nfoiled/window.rb +++ b/lib/nfoiled/window.rb @@ -31,16 +31,15 @@ module Nfoiled # Responsible for creating a new `Window`, this will also take care of # initializing Ncurses if necessary. def initialize opts = Hash.new - { :top => 0, :left => 0, :height => 0, :width => 0 }.merge opts Nfoiled::initialize - @top = opts[:top] - @left = opts[:left] - @height = opts[:height] - @width = opts[:width] - @wrapee = ::Ncurses.newwin(opts[:height], opts[:width], opts[:top], opts[:left]) - @owner = Terminal.current - @owner.windows << self + @wrapee = ::Ncurses.newwin( + opts[:height] ? @height = opts[:height] : 0, + opts[:width] ? @width = opts[:width] : 0, + opts[:top] ? @top = opts[:top] : 0, + opts[:left] ? @left = opts[:left] : 0) + + (@owner = Terminal.current).windows << self end ## -- 2.11.4.GIT