Condition as a parameter of a method in ruby -


i working class collection rows containing data. created method

range#selection!(field, condition)  

to reduce contained rows not match condition.

for while enough provide regex condition eliminate rows field had values not fitting regex...

now need compare field values in mathematical sense <=, >= , more worse need filter fields contain date later specified date...

def selection!(field) {value<=3} value = 4 if yield ... end 

this not working somehow need... passing condition can earliest evaluate when "value" has vale inside method. avoiding move [...] in block tht rwrite on , on again

ideas?

marc

what if pass block method , in method use select/reject_if block filter out collection?


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -