Ċ½eljko Filipin wrote:
> This would make sense to me (no question mark)
>
> link = $ie.link(:class => 'addtocart', :after => headline)
>
> "By convention, methods that answer questions (i.e. Array#empty?
> returns *true* if the receiver is empty) end in question marks."
> (http://www.ruby-lang.org/en/documentation/ruby-from-other-languages/
> <http://www.ruby-lang.org/en/documentation/ruby-from-other-languages/>)
>
> This is not a method, but this convention really makes sense to me, so
> I expect anything that ends with question mark to return true or
> false. Why did you use question mark?
Actually it is a method, but not obviously so.
A major structural change between Watir 1.4 and Watir 1.5 is that in
1.5, these 'conventions' actually are methods. In other words, there is
a deep similarity between
link = ($ie.links.collect {|l| l.class_name == 'addtocart'))[0]
and
link = $ie.link(:class_name => 'addtocart')
(In the case of :class, we map it to the Element#class_name method
because Object#class is already taken.)
In other words, my proposal implicitly includes adding a method
Element#after? that returns true or false based on the relation ship
between self and the argument. That is why it has a question mark. But i
can see that retaining the question mark in the attribute syntax may be
confusing and will make it work without it too.
Bret
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general