Class: Browser::Window::Size
- Defined in:
- lib/diamonds/opal/browser/window/size.rb
Overview
Allows access and manipulation of the Browser::Window size.
Instance Attribute Summary collapse
-
#width ⇒ Integer
The width of the window.
Instance Method Summary collapse
- #height ⇒ Object
- #height=(value) ⇒ Object
-
#initialize(window) ⇒ Size
constructor
A new instance of Size.
- #set(*args) ⇒ Object
Constructor Details
#initialize(window) ⇒ Size
Returns a new instance of Size.
6 7 8 9 |
# File 'lib/diamonds/opal/browser/window/size.rb', line 6 def initialize(window) @window = window @native = window.to_n end |
Instance Attribute Details
#width ⇒ Integer
Returns the width of the window.
|
# File 'lib/diamonds/opal/browser/window/size.rb', line 26
|
Instance Method Details
#height ⇒ Object
37 38 39 |
# File 'lib/diamonds/opal/browser/window/size.rb', line 37 def height `#@native.outerHeight` end |
#height=(value) ⇒ Object
54 55 56 |
# File 'lib/diamonds/opal/browser/window/size.rb', line 54 def height=(value) set(height: value) end |
#set(*args) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/diamonds/opal/browser/window/size.rb', line 11 def set(*args) if Hash === args.first width, height = args.first.values_at(:width, :height) else width, height = args end width ||= self.width height ||= self.height `#@native.resizeTo(#{width}, #{height})` self end |