summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorTom Black <[email protected]>2016-04-21 23:45:12 -0400
committerTom Black <[email protected]>2016-04-21 23:45:12 -0400
commit44fff6e26bf8ab185b632bdaedcd4b7789a7c791 (patch)
treef7b94f89f3fc68160558373ce1b1323bb6bc909e /lib
parentaf260b3cb978f87cf79aa234ea1a97ec4f88cfb9 (diff)
downloadruby2d-44fff6e26bf8ab185b632bdaedcd4b7789a7c791.tar.gz
ruby2d-44fff6e26bf8ab185b632bdaedcd4b7789a7c791.zip
Fix failing DSL test
`set` must be able set a single window attribute without making others nil
Diffstat (limited to 'lib')
-rw-r--r--lib/ruby2d/window.rb14
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)