[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Metho Error

Ruby Geo

12/19/2007 1:55:00 PM

Why do I get the folowing error when I run this method ? ?



wrong number of arguments (2 for 3) (ArgumentError)
from C:/Ruby/methodscop/lib/new_class.rb:65
--------------------------------------------------------------------

def self.search_by_keyword(businesses, searched_keyword_as_array,
flag_exact_or_partial_match)
businesses.select do |b|
b.my_keywords.include?(searched_keyword_as_array )
end
end
--
Posted via http://www.ruby-....

2 Answers

yermej

12/19/2007 2:26:00 PM

0

On Dec 19, 7:55 am, Ruby Geo <ruby...@googlemail.com> wrote:
> Why do I get the folowing error when I run this method ? ?
>
> wrong number of arguments (2 for 3) (ArgumentError)

Seriously? Well, I'm going to go out on a limb and guess that you only
passed in two arguments instead of three. Or at least I think that's
what "wrong number of arguments (2 for 3)" would mean.


> from C:/Ruby/methodscop/lib/new_class.rb:65
> --------------------------------------------------------------------
>
> def self.search_by_keyword(businesses, searched_keyword_as_array,
> flag_exact_or_partial_match)
> businesses.select do |b|
> b.my_keywords.include?(searched_keyword_as_array )
> end
> end
> --
> Posted viahttp://www.ruby-....

Ruby Geo

12/19/2007 3:46:00 PM

0

yermej wrote:
> On Dec 19, 7:55 am, Ruby Geo <ruby...@googlemail.com> wrote:
>> Why do I get the folowing error when I run this method ? ?
>>
>> wrong number of arguments (2 for 3) (ArgumentError)
>
> Seriously? Well, I'm going to go out on a limb and guess that you only
> passed in two arguments instead of three. Or at least I think that's
> what "wrong number of arguments (2 for 3)" would mean.

well that's true I passed only two argument. But my question is How do
I use that method in order to display this.

Business.search_by_keyword([bsn0, bsn1, bsn2], [KEYWORDS[0],KEYWORDS[2]
],false) # true here mean 'partial match'
# will return bsn0 AND bsn1
--
Posted via http://www.ruby-....