我错过了什么吗?
class Circus
private
def start
puts 'And now for something completely different..'
end
end
对于我的幻灭:
c=Circus.new
c.start #NoMethodError: private method `start' called
c.method(:start).call #no problem at all
c.send :start #neither this fails
谁能给我一个为什么 Ruby 中存在私有方法的原因?