我想修补一个为其创建的方法,alias_method_chain
但不调用覆盖的方法
# foo.rb
require 'active_support/core_ext'
class Foo
def foo
"original foo"
end
def foo_with_flag
"foo with flag"
end
alias_method_chain :foo, :flag
end
# foo_ext.rb
class Foo
def foo_with_flag
"overridden foo with flag"
end
end
foo = Foo.new
foo.foo # => "foo with flag"
foo.foo_with_flag # => "overridden foo with flag"
我怎样才能Foo#foo
使用的最后一个实现Foo#foo_with_flag
?