It has nothing to do with the ternary operator. The arity is 0
, which is less than 1
, so you're comparing instance_eval(&block)
(apples) and block[self]
(oranges). You'd get the same result if you did
def self.generate(filename, &block)
instance_eval(&block)
p '---'
block[self]
end
And the difference is easy to understand: the former is evaluated with self
being a Prawn::Document
class object, and in the latter, self
is an instance of A
.