Class: Watir::BaseDecorator

Inherits:
Object
  • Object
show all
Defined in:
lib/watir-webdriver/wait.rb

Direct Known Subclasses

WhenEnabledDecorator, WhenPresentDecorator

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of BaseDecorator.



99
100
101
102
103
# File 'lib/watir-webdriver/wait.rb', line 99

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(m, *args, &block) ⇒ Object



109
110
111
112
113
114
115
116
117
# File 'lib/watir-webdriver/wait.rb', line 109

def method_missing(m, *args, &block)
  unless @element.respond_to?(m)
    raise NoMethodError, "undefined method `#{m}' for #{@element.inspect}:#{@element.class}"
  end

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

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

Instance Method Details

#respond_to?(*args) ⇒ Boolean

Returns:

  • (Boolean)


105
106
107
# File 'lib/watir-webdriver/wait.rb', line 105

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