./vcard.rb:246: warning: each_with (…) interpreted as method call
but, I don’t know how to make my method calls look any more like a
method call than they already do!
What’s going on?
# Calls block once for each field for which +cond+ is true.
def each_with(block, &cond) # :yields: field
@fields.each { |field| if cond.call(field); block.call(field); end }
end
# Calls block once for each field named +name+.
def each_with_name(name, &block) # :yields: field
each_with (block) { |field| field.name?(name) } <----------- causes a warning, but why?
end
./vcard.rb:246: warning: each_with (…) interpreted as method call
but, I don’t know how to make my method calls look any more like a
method call than they already do!
What’s going on?
# Calls block once for each field for which +cond+ is true.
def each_with(block, &cond) # :yields: field
@fields.each { |field| if cond.call(field); block.call(field); end }
end
# Calls block once for each field named +name+.
def each_with_name(name, &block) # :yields: field
each_with (block) { |field| field.name?(name) } <-----------
causes a warning, but why?
end
My first guess (untested) is that it’s the space
before the parens that is causing the parser to
do a doubletake.
Hal
···
----- Original Message -----
From: “Sam Roberts” sroberts@uniserve.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Sunday, February 09, 2003 2:04 PM
Subject: I have method call, but I get warning: … interpreted as method