I understand that
def a(&block) block.call(self) end
and
def a() yield self end
will produce the same result if I assume that such a block a {} exists. My question is that since I came across some kind of code like this, regardless of whether it has any meaning or if there are any advantages of having (unless I use a variable / link block otherwise case):
def a(&block) yield self end
This is a specific case where I do not understand the use of &block :
def rule(code, name, &block) @rules = [] if @rules.nil? @rules << Rule.new(code, name) yield self end
Big x source share