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



159
160
161
162
163
164
165
166
167
# File 'lib/vapir-common/browser.rb', line 159

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



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

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



133
134
135
136
137
138
139
140
141
142
143
# File 'lib/vapir-common/browser.rb', line 133

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



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

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