As noted in the comments, the question is actually the answer. If the method gets a block, I want to use it further. But I also have a variant where ...
As noted in the comments, the question is actually the answer. If the method gets a block, I want to use it further. But I also have a variant where ...
I was wondering if it was possible to pass as parameter the if condition statement as string or symbol. Because method name or if statement name could ...
I'm unclear on why there is a need to pass block arguments when calling a function. why not just pass in as function arguments and what happens to the ...
I have the following accordion generator which works fine when included directly in the view: Now I wanted to move toward a more clean implementat ...
The following code gives me NameError: undefined local variable or method `dir' in extract_snapshots method. The code is intended to extract snapshot ...
I am comfortable with the following: So I have learned to keep blocks (and procs) separate from the yield keyword. However, I ran into the followi ...
I'm writing a chef recipe wherein an sql command is run. But when I check the log, it does not run the SQL command. It runs, Seems it is trying ...
Can a block in Ruby be written inside class or module? as per docs a block can be called from methods using yield...i.e it should be callable from met ...
have an next case: expecting test4 to return result as test3 I guess maybe mysql returning result not to stdout, where then and how can I get the ...
I need to include res-client into my module in order to use RestClient::Resource. I use the method in the module in a Chef recipe (ruby_block resourc ...
I have a method and in order to check whether it is being passed a block, I do the following: However RuboCop is giving me a warning which I don't ...
The above is the current configure block and request block I have been using, unfortunately it is not producing the results I want. I receive: I ...
Having for example sum = 0 Now on sum I would like to add the value of an attribute that each object from the block has it eg Is there a way to ...
I want to return the output of yield but also execute the code after yield, is there a more "right" way?: ...
I want to check whether the block is called in my function using rspec. Below is my code: Below is my error: Could you please help. I spent lots ...
I want to test the functionality of the method using rspec that receives anonymous block and not raise error. Below is my code: It is below throwin ...
I'm doing the following: Can I call map and compact in one statement somehow, so I can return the result instantly? I'm thinking on something like ...
I'm having some trouble understanding why I can't call select with round brackets. As far as I can tell select is a regular method. I though rou ...
my first time to ask stuff on stack-overflow, here in china i seldom able to meet any chef developer to talk about my problem so i am posting it here ...
Ok, so I've build a DSL and part of it requires the user of the DSL to define what I called a 'writer block' The writer block gets called like this ...