【发布时间】:2011-02-03 01:15:47
【问题描述】:
为什么你可以把这个链接起来:
"Test".upcase.reverse.next.swapcase
但不是这个:
x = My_Class.new
x.a.b.c
在哪里
class My_Class
def a
@b = 1
end
def b
@b = @b + 2
end
def c
@b = @b -72
end
end
【问题讨论】:
-
以下链接stackoverflow.com/questions/3955688/how-do-i-debug-ruby-scripts/… 可以让您更好地了解Ruby 中发生了什么。
-
哦,所以你认为我不运行调试? ;)
-
在提问之前您是否尝试过
x.a(没有.b.c)?