diff options
Diffstat (limited to 'lib/ruby2d/window.rb')
| -rw-r--r-- | lib/ruby2d/window.rb | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/ruby2d/window.rb b/lib/ruby2d/window.rb index 1b3698e..299a1dd 100644 --- a/lib/ruby2d/window.rb +++ b/lib/ruby2d/window.rb @@ -38,16 +38,10 @@ module Ruby2D end def set(opts) - valid_keys = [:title, :width, :height] - valid_opts = opts.reject { |k| !valid_keys.include?(k) } - if !valid_opts.empty? - @title = valid_opts[:title] - @width = valid_opts[:width] - @height = valid_opts[:height] - return true - else - return false - end + # Store new window attributes, or ignore if nil + @title = opts[:title] || @title + @width = opts[:width] || @width + @height = opts[:height] || @height end def add(o) |
