Module: Vapir::WatirConfigCompatibility::WatirBrowserClassConfigCompatibility

Defined in:
lib/vapir-common/browser.rb

Constant Summary collapse

OptionsKeys =
[:speed, :attach_timeout, :visible]

Instance Method Summary collapse

Instance Method Details

#attach_timeoutObject



170
171
172
173
174
175
176
177
178
# File 'lib/vapir-common/browser.rb', line 170

def attach_timeout
  if self==Vapir::Browser
    return browser_class.attach_timeout
  end
  if config.warn_deprecated
    Kernel.warn_with_caller "WARNING: #attach_timeout is deprecated; please use the new config framework with config.attach_timeout"
  end
  config.attach_timeout
end

#attach_timeout=(timeout) ⇒ Object



179
180
181
182
183
184
185
186
187
# File 'lib/vapir-common/browser.rb', line 179

def attach_timeout=(timeout)
  if self==Vapir::Browser
    return browser_class.attach_timeout=timeout
  end
  if config.warn_deprecated
    Kernel.warn_with_caller "WARNING: #attach_timeout= is deprecated; please use the new config framework with config.attach_timeout="
  end
  config.attach_timeout = timeout
end

#optionsObject



144
145
146
147
148
149
150
151
152
153
154
# File 'lib/vapir-common/browser.rb', line 144

def options
  if self==Vapir::Browser
    return browser_class.options
  end
  if config.warn_deprecated
    Kernel.warn_with_caller "WARNING: #options is deprecated; please use the new config framework"
  end
  OptionsKeys.inject({}) do |hash, key|
    respond_to?(key) ? hash.merge(key => self.send(key)) : hash
  end.freeze
end

#set_options(options) ⇒ Object



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/vapir-common/browser.rb', line 155

def set_options(options)
  if self==Vapir::Browser
    return browser_class.set_options(options)
  end
  if config.warn_deprecated
    Kernel.warn_with_caller "WARNING: #set_options is deprecated; please use the new config framework"
  end
  
  unless (unknown_options = options.keys - OptionsKeys.select{|key| respond_to?("#{key}=")}).empty?
    raise ArgumentError, "unknown options: #{unknown_options.inspect}"
  end
  options.each do |key, value|
    self.send("#{key}=", value)
  end
end