Ruby-Watit

Hi,

I am using Watir to automate our regression test suite.

I have following question.

In watir I canot expand widgets.Could you please explan me the way to
expand the widgets using watir tool.

Please refer the screen shot for more information.

Uthpala Dissanayake wrote:

Hi,

I am using Watir to automate our regression test suite.

I have following question.

In watir I canot expand widgets.Could you please explan me the way to write scripts to expand the widgets using watir tool.

Please refer the screen shot for more information.

Hi,

In ruby 1.8.7 this does not work (syntax error):

class A

def test=(val, &block)
end

end

A.new.test = 10 do
end

I would really like to an associate a block in this way. Is there a way
round this?

Cheers,
James

Whoaa… never do it this way, and it seems doesn’t work in 1.9 too
and I agree with you, that it should works. Ruby’s bug ??

Thanks for checking this. I guess I should raise a bug report.

end

A.new.test = 10 do
end

I would really like to an associate a block in this way. Is there a way
round this?

I’m pretty sure this is not a bug. It’s been discussed once or twice
before on the ruby-talk list.

What are you trying to do with this syntax? Note the potential for
ambiguity:

A.new.test = [1,2,3].find do |i| i>1 end

This is currently parsed as

A.new.test = (
[1,2,3].find do |i| i>1 end
)

On Thu, Jun 11, 2009 at 2:55 AM, James
French[email protected] wrote:

I would really like to an associate a block in this way. Is there a way round this?

I don’t think so. It isn’t parsed as a normal method call, its parsed
as a special construct with the = that is converted into a method call
in a way which doesn’t support picking up a block. I don’t really
think that using = this way would be a good idea even if you could.

2009/6/12 Christopher D. [email protected]:

On Thu, Jun 11, 2009 at 2:55 AM, James
French[email protected] wrote:

I would really like to an associate a block in this way. Is there a way round this?

I don’t think so. It isn’t parsed as a normal method call, its parsed
as a special construct with the = that is converted into a method call
in a way which doesn’t support picking up a block. I don’t really
think that using = this way would be a good idea even if you could.

+1

If I see this

foo.bar = x do
something
end

I assume that “foo.bar” becomes the result of evaluating “x do …
end”. And the Ruby interpreter does so, too. Joel is absolutely
right about the ambiguity. Note also that this it is not possible to
somehow make a block work with a “regular” assignment (i.e. a direct
variable assignment):

bar = x do
something
end

Again, x will be called with the block and the result will be assigned
to bar. It would be a very bad idea IMHO to introduce inconsistencies
here. Please rather try to find a different solution. Note that you
can always do

def bar(&b)
@block = b
end

And then

foo.bar do
something
end

Kind regards

robert