Passing multiple code blocks as arguments in Ruby

You can’t pass multiple blocks, per se, but you can pass multiple procs or lambdas: Using 1.9 syntax: opportunity ->{ @some_array.empty? }, ->{ @some_other_array.empty? } and in the method itself: def opportunity(lambda1, lambda2) if lambda1.() @opportunities += 1 end if lambda2.() @performances += 1 end end

Ruby: Proc#call vs yield

I think the first one is actually a syntactic sugar of the other. In other words there is no behavioural difference. What the second form allows though is to “save” the block in a variable. Then the block can be called at some other point in time – callback. Ok. This time I went and … Read more

WWW/UnityWebRequest POST/GET request won’t return the latest data from server/url

This is happening because resources caching is enabled on the Server. Three possible solutions I know about: 1.Disable resources caching on the server. Instructions are different for every web server. Usually done in .htaccess. 2.Make each request with unique timestamp. The time should in Unix format. This method will not work on iOS. You are … Read more