[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Checking results

Ruby Geo

12/20/2007 10:58:00 AM

Hi

I am having difficulty in passing the folowing class method, that takes
three argument. Basically I need the method to display the right data
after doing all the check ups.
This is the method.
-----------------------
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).true
b.my_keywords.include?(searched_keyword_as_array )
#flag_exact_or_partial_match = true
end
end


The object created from the class.
=---------------------------------------------
bsn1 = Business.new("Steve", "02089293323", "22 lilly Road ")
bsn1.add_keyword(KEYWORDS[0])
bsn1.add_keyword(KEYWORDS[2])


Method call
-----------------------------------------
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-....