On 5/18/07, Bret Pettichord <[EMAIL PROTECTED]> wrote:


If we are going to tell everyone to do 'include Watir', then we could
make things easier by putting just this line of code in watir.rb and
have it execute automatically when the 'require "watir"' happens.


Huh, could you do that?

Here are my decidely non-expert understandings about what requiring and
including do, based on playing around:

  - require 'watir' => I want to use things from watir (generally
  methods, possibly also constants, etc.)
  - include Watir => I don't want to have to type Watir:: in front of
  any watir methods I use. (Put more precisely, when I call a method without
  pre-pending it with the name of a file, check both this file and whatever
  files I've included.)

If anyone who understands the above better than I do wants to add to or
correct the above, I'd appreciate it.

From my perspective, I always start out by requiring and including watir,
because I'd rather paste it into the top of a script once than have to type
Watir:: several times below.

I was planning to say that I'd love to have watir automatically included
whenever I require it...but that might have resulted in unneccessary
confusion when I first started requiring (and wishing to include) other ruby
modules. So in the end I think my vote is to teach include from the
beginning, but not to have require automagically include as well...since
that's not true for other ruby modules.

Or to put in another way, why put the Watir code in a module when you
are just going to tell users to import the module into the toplevel name
space?

Bret
_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general




--
http://testingjeff.wordpress.com
_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to