class AutomationObject::State::ElementProxy

Proxy class to allow for usage of hooks

Public Class Methods

new(composite, element) click to toggle source
# File lib/automation_object/state/element_proxy.rb, line 9
def initialize(composite, element)
  @composite = composite
  @subject = element
end

Public Instance Methods

method_missing(method_symbol, *args, &block) click to toggle source

Overiding base method to run possible hooks

# File lib/automation_object/state/element_proxy.rb, line 15
def method_missing(method_symbol, *args, &block)
  # Run before hook if needed
  @composite.method_hooks[method_symbol].before if @composite.method_hook?(method_symbol)

  subject_return = @subject.send(method_symbol, *args, &block)

  # Run after hook if needed
  @composite.method_hooks[method_symbol].after if @composite.method_hook?(method_symbol)

  subject_return
end
respond_to_missing?(method, include_private = false) click to toggle source
# File lib/automation_object/state/element_proxy.rb, line 27
def respond_to_missing?(method, include_private = false)
  @subject.respond_to_missing?(method, include_private)
end