Q:

Is the use of return in Ruby not idiomatic?

I have been refactoring some code today and have made a lot of my methods much neater with fairly heavy use of return. One thing that occurred to me is how infrequently I have seen return used in sample code, blog posts, etc, which led me to think that I'm doing something wrong.
Is using return not idiomatic in Ruby? Should I be aiming to just have my methods just return a final value through if/else, case/when statements, rather than interrupt them early with return?

A:

The core in Ruby is to only use return when you need to. If early termination with return makes your method clearer, do it. In other words:
DO:
def method(arg)
  if(arg == 0) #Special case
    return 42
  end
  arg + 46
end

DON'T:
def method(arg)
  return arg + 46
end

BEST:
def method(arg)
  if(arg == 0)
    42
  else
    arg + 46
  end
end

However, return is only discouraged only when unnecessary. 

