summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ruby2d/window.rb19
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/ruby2d/window.rb b/lib/ruby2d/window.rb
index 322d94c..1b3698e 100644
--- a/lib/ruby2d/window.rb
+++ b/lib/ruby2d/window.rb
@@ -38,16 +38,15 @@ module Ruby2D
end
def set(opts)
- if opts.include? :title
- @title = opts[:title]
- end
-
- if opts.include? :width
- @width = opts[:width]
- end
-
- if opts.include? :height
- @height = opts[:height]
+ 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
end