browser.rb

0 views
Skip to first unread message

aidy lewis

unread,
Jan 6, 2009, 12:46:19 PM1/6/09
to watir-...@googlegroups.com
Hi

Can anyone please tell me why the new operator (klass.new) here is
used on what looks like a private method?

# Create a new instance of a browser driver, as determined by the
# configuration settings. (Don't be fooled: this is not actually
# an instance of Browser class.)
def new
set_sub_options
klass.new
end
# Create a new instance as with #new and start the browser on the
# specified url.
def start url
set_sub_options
klass.start url
end
def klass
key = Watir.options[:browser]
eval @@browser_classes[key] # this triggers the autoload
end
private :klass

Thanks

Aidy

Richard Lawrence

unread,
Jan 6, 2009, 1:40:08 PM1/6/09
to watir-...@googlegroups.com
Not on the method itself, but on the return value of the method call,
which is the appropriate browser class "as determined by the
configuration settings."

Richard

--
Richard Lawrence
Certified Scrum Coach
Founder and Principal Consultant, Humanizing Work, LLC
303-895-7688
ric...@humanizingwork.com
www.humanizingwork.com
www.richardlawrence.info
Reply all
Reply to author
Forward
0 new messages