Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ruby: do nothing (dummy) function

When working with ruby on rails code, what is the conventional way (or most elegant way) to let rails do nothing? For example when debugging and commenting out a line where there has to be a statement:

begin
  #some_commented_out_function
rescue => e
[...]
end

Is there a dummy function I quickly can put in instead of the commented out line? What is the convention for this?

like image 361
John Alba Avatar asked Oct 15 '25 04:10

John Alba


1 Answers

Ruby doesn't have a pass or no-op statement. In your example, that code would work as written, with or without a comment.

If you'd like to make it explicit, a line with just nil or a comment explaining the method would probably be considered conventional.

like image 61
Milo P Avatar answered Oct 17 '25 17:10

Milo P