On 12/22/06, Bret Pettichord <[EMAIL PROTECTED]> wrote:
> So we have consistently urged people to wrap their watir expressions in
> methods rather than assign them to global variables. This makes it easy
> to reuse them, and ensure that a correct rebinding occurs on each reuse.
> Also, as i have been using Watir more on large projects, i am finding
> that there are other reasons why this is a sound way to structure Watir
> libraries.
im not sure if i understand this correctly.
text = $ie.text <-- so, this is bad because we cant be sure if the
rebinding happens just in time when we need it.
would the following approach be better?:
class Page
def initialize ie
@ie = ie
end
def text
@ie.text
end
end
p = Page.new ie
puts p.text
the watir expressions are now wrapped in methods but i cant see how
the object binding could be different from using global vars. I hope
someone can enlighten me on this ;)
Christian
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general