-1
我的新軌道時遇到同一類,但不同的實例變量在同級別
class A
def x
@z = params[:something]
#someother code i dont
end
def y
#self.x returns the full instance method but i just want @z without the entire method
end
end
我如何做到這一點
內訪問變量的這個問題的另一個實例變量中訪問實例方法變量
這是非常有用的,但我不知道有沒有更好的解決辦法? – user2903934