Class: Watir::BaseDecorator

Inherits:
Object
  • Object
show all
Defined in:
lib/watir/legacy_wait.rb

Direct Known Subclasses

WhenEnabledDecorator, WhenPresentDecorator

Instance Method Summary collapse

Constructor Details

#initialize(element, timeout, message = nil) ⇒ BaseDecorator


6
7
8
9
10
# File 'lib/watir/legacy_wait.rb', line 6

def initialize(element, timeout, message = nil)
  @element = element
  @timeout = timeout
  @message = message
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object


16
17
18
19
20
21
22
# File 'lib/watir/legacy_wait.rb', line 16

def method_missing(method, *args, &block)
  return super unless @element.respond_to?(method)

  Wait.until(@timeout, @message) { wait_until }

  @element.__send__(method, *args, &block)
end

Instance Method Details

#respond_to_missing?(*args) ⇒ Boolean


12
13
14
# File 'lib/watir/legacy_wait.rb', line 12

def respond_to_missing?(*args)
  @element.respond_to?(*args)
end