File: class_instance_method_defined.rb

package info (click to toggle)
ruby-rr 3.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,424 kB
  • sloc: ruby: 11,405; makefile: 7
file content (9 lines) | stat: -rw-r--r-- 510 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
module RR
  module ClassInstanceMethodDefined
    def class_instance_method_defined(klass, instance_method, include_super=true)
      klass.instance_methods(include_super).detect {|method_name| method_name.to_sym == instance_method.to_sym} ||
        klass.protected_instance_methods(include_super).detect {|method_name| method_name.to_sym == instance_method.to_sym} ||
        klass.private_instance_methods(include_super).detect {|method_name| method_name.to_sym == instance_method.to_sym}
    end
  end
end