当您需要对一个对象执行多种方法时,您更喜欢哪种解决方案?
代码应该不言自明:
class Foo
def self.build
foo = new
foo.first
foo.second
foo
end
def first
end
def second
end
end
class Bar
def self.build
new.first.second
end
def first
self
end
def second
self
end
end