开发者

Get included method names

How I can get all instance method names in the baz method call, which are only present in the Bar module (without other instance methods of this class) ?

class F开发者_如何学Coo
  include Bar

  def a
  end

  def b
  end

  def baz
    #HERE
  end
end


class Foo
  include Bar

  def a
  end

  def b()
  end

  def baz
    Bar.instance_methods(false)
  end
end

puts Foo.new.baz
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜