Class: AutomationObject::Dsl::ModalProxy
- Inherits:
-
Proxy
- Object
- Proxy::Proxy
- Proxy
- AutomationObject::Dsl::ModalProxy
- Defined in:
- lib/automation_object/dsl/modal.rb
Overview
Proxy for Modal
Instance Method Summary collapse
- #active? ⇒ Boolean
-
#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 modal Will try to automatically reach it, will throw error if it cannot.
-
#initialize(blue_prints, state, name) ⇒ ModalProxy
constructor
A new instance of ModalProxy.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(blue_prints, state, name) ⇒ ModalProxy
Returns a new instance of ModalProxy
25 26 27 |
# File 'lib/automation_object/dsl/modal.rb', line 25 def initialize(blue_prints, state, name) super Modal, blue_prints, state, name end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/automation_object/dsl/modal.rb', line 32 def method_missing(method, *args, &block) return super if Modal.methods.include?(method) # Attempt to load modal if composite object contains that child @state.utilize if @subject.to_h.include?(method) super end |
Instance Method Details
#active? ⇒ Boolean
42 43 44 |
# File 'lib/automation_object/dsl/modal.rb', line 42 def active? @state.active? end |
#element(name) ⇒ AutomationObject::Dsl::ElementProxy
Retrieve element from composite
58 59 60 61 62 63 64 |
# File 'lib/automation_object/dsl/modal.rb', line 58 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
70 71 72 73 74 75 76 |
# File 'lib/automation_object/dsl/modal.rb', line 70 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
82 83 84 85 86 87 88 |
# File 'lib/automation_object/dsl/modal.rb', line 82 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 modal Will try to automatically reach it, will throw error if it cannot
50 51 52 |
# File 'lib/automation_object/dsl/modal.rb', line 50 def go @state.go end |