Class: QAT::Web::Screen::Wrapper
- Inherits:
-
Object
- Object
- QAT::Web::Screen::Wrapper
- Includes:
- Logger
- Defined in:
- lib/qat/web/screen/wrapper.rb
Overview
Screen wrapper to represent an abstract display. Can have a Headless instance associated.
Instance Attribute Summary collapse
-
#depth ⇒ String
readonly
Screen depth.
-
#height ⇒ String
readonly
Screen height.
-
#name ⇒ String
readonly
Screen name.
-
#options ⇒ Hash
readonly
Initialization options.
-
#width ⇒ String
readonly
Screen width.
-
#xvfb ⇒ Headless
readonly
Xvfb instance representing the screen.
Instance Method Summary collapse
-
#destroy ⇒ Object
Destroy the Xvfb instance.
-
#initialize(name, options) ⇒ Wrapper
constructor
Create a new screen.
-
#method_missing(method, *args, &block) ⇒ Object
Redirect all unknown methods to the Xvfb instance.
-
#start ⇒ Headless
Start a new Xvfb instance.
Constructor Details
#initialize(name, options) ⇒ Wrapper
Create a new screen.
43 44 45 46 47 48 49 |
# File 'lib/qat/web/screen/wrapper.rb', line 43 def initialize name, @name = name @options = parse_resolution log.info "Created screen with #{width}x#{height}x#{depth}" @xvfb = nil end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
Redirect all unknown methods to the Xvfb instance
72 73 74 |
# File 'lib/qat/web/screen/wrapper.rb', line 72 def method_missing method, *args, &block @xvfb.method(method).call *args, &block end |
Instance Attribute Details
#depth ⇒ String (readonly)
Returns Screen depth.
32 33 34 |
# File 'lib/qat/web/screen/wrapper.rb', line 32 def depth @depth end |
#height ⇒ String (readonly)
Returns Screen height.
28 29 30 |
# File 'lib/qat/web/screen/wrapper.rb', line 28 def height @height end |
#name ⇒ String (readonly)
Returns Screen name.
16 17 18 |
# File 'lib/qat/web/screen/wrapper.rb', line 16 def name @name end |
#options ⇒ Hash (readonly)
Returns Initialization options.
20 21 22 |
# File 'lib/qat/web/screen/wrapper.rb', line 20 def @options end |
#width ⇒ String (readonly)
Returns Screen width.
24 25 26 |
# File 'lib/qat/web/screen/wrapper.rb', line 24 def width @width end |
#xvfb ⇒ Headless (readonly)
Returns Xvfb instance representing the screen.
36 37 38 |
# File 'lib/qat/web/screen/wrapper.rb', line 36 def xvfb @xvfb end |
Instance Method Details
#destroy ⇒ Object
Destroy the Xvfb instance
63 64 65 66 67 68 |
# File 'lib/qat/web/screen/wrapper.rb', line 63 def destroy return unless @xvfb @xvfb.destroy log.info "Xvfb #{name} screen destroyed" @xvfb = nil end |