Class: AutomationObject::Dsl::ScreenProxy
- Inherits:
-
Proxy
- Object
- Proxy::Proxy
- Proxy
- AutomationObject::Dsl::ScreenProxy
- Defined in:
- lib/automation_object/dsl/screen.rb
Overview
Proxy for Screen
Instance Method Summary collapse
-
#active? ⇒ Boolean
Is the screen active.
-
#close ⇒ void
Close screen.
-
#element(name) ⇒ AutomationObject::Dsl::ElementProxy
Retrieve element from composite.
-
#element_array(name) ⇒ AutomationObject::Dsl::ElementArrayProxy
Retrieve element array from composite.
-
#element_hash(name) ⇒ AutomationObject::Dsl::ElementHashProxy
Retrieve element hash from composite.
-
#go ⇒ Boolean
Go to this screen Will try to automatically reach it, will throw error if it cannot.
-
#initialize(blue_prints, state, name) ⇒ ScreenProxy
constructor
A new instance of ScreenProxy.
- #method_missing(method, *args, &block) ⇒ Object
-
#modal(name) ⇒ AutomationObject::Dsl::ModalProxy, AutomationObject::Dsl::ScreenProxy
Retrieve modal or self from composite.
Constructor Details
#initialize(blue_prints, state, name) ⇒ ScreenProxy
Returns a new instance of ScreenProxy
27 28 29 |
# File 'lib/automation_object/dsl/screen.rb', line 27 def initialize(blue_prints, state, name) super Screen, blue_prints, state, name end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/automation_object/dsl/screen.rb', line 34 def method_missing(method, *args, &block) return super if Screen.methods.include?(method) # Attempt to load screen if composite object contains that child @state.utilize if @subject.to_h.include?(method) super end |
Instance Method Details
#active? ⇒ Boolean
Is the screen active
45 46 47 |
# File 'lib/automation_object/dsl/screen.rb', line 45 def active? @state.active? end |
#close ⇒ void
This method returns an undefined value.
Close screen
51 52 53 |
# File 'lib/automation_object/dsl/screen.rb', line 51 def close @state.close end |
#element(name) ⇒ AutomationObject::Dsl::ElementProxy
Retrieve element from composite
80 81 82 83 84 85 86 |
# File 'lib/automation_object/dsl/screen.rb', line 80 def element(name) name = name.to_sym raise AutomationObject::Dsl::Error::ElementDoesNotExistError, name unless @subject.to_h.include?(name) @state.utilize @subject.send(name) end |
#element_array(name) ⇒ AutomationObject::Dsl::ElementArrayProxy
Retrieve element array from composite
92 93 94 95 96 97 98 |
# File 'lib/automation_object/dsl/screen.rb', line 92 def element_array(name) name = name.to_sym raise AutomationObject::Dsl::Error::ElementArrayDoesNotExistError, name unless @subject.to_h.include?(name) @state.utilize @subject.send(name) end |
#element_hash(name) ⇒ AutomationObject::Dsl::ElementHashProxy
Retrieve element hash from composite
104 105 106 107 108 109 110 |
# File 'lib/automation_object/dsl/screen.rb', line 104 def element_hash(name) name = name.to_sym raise AutomationObject::Dsl::Error::ElementHashDoesNotExistError, name unless @subject.to_h.include?(name) @state.utilize @subject.send(name) end |
#go ⇒ Boolean
Go to this screen Will try to automatically reach it, will throw error if it cannot
59 60 61 |
# File 'lib/automation_object/dsl/screen.rb', line 59 def go @state.go end |
#modal(name) ⇒ AutomationObject::Dsl::ModalProxy, AutomationObject::Dsl::ScreenProxy
Retrieve modal or self from composite
66 67 68 69 70 71 72 73 74 |
# File 'lib/automation_object/dsl/screen.rb', line 66 def modal(name) name = name.to_sym raise AutomationObject::Dsl::Error::ModalDoesNotExistError, name unless @subject.to_h.include?(name) @state.utilize return @subject.send(name) if @subject.send(name) self end |