Class: AutomationObject::Dsl::ModalProxy

Inherits:
Proxy show all
Defined in:
lib/automation_object/dsl/modal.rb

Overview

Proxy for Modal

Instance Method Summary collapse

Constructor Details

#initialize(blue_prints, state, name) ⇒ ModalProxy

Returns a new instance of ModalProxy

Parameters:



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

Parameters:

  • method (Symbol)
  • args (Array, nil)
  • block (Proc)


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

Returns:

  • (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

Parameters:

  • name (String, Symbol)

    name of element

Returns:

Raises:



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

Parameters:

  • name (String, Symbol)

    name of element array

Returns:

Raises:



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

Parameters:

  • name (String, Symbol)

    name of element hash

Returns:

Raises:



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

#goBoolean

Go to this modal Will try to automatically reach it, will throw error if it cannot

Returns:

  • (Boolean)

Raises:

  • (AutomationObject::Dsl::Error::AutoReachModalError)


50
51
52
# File 'lib/automation_object/dsl/modal.rb', line 50

def go
  @state.go
end