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-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Checking results
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password