File: public_method.rb

package info (click to toggle)
ruby-backports 3.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,460 kB
  • ctags: 703
  • sloc: ruby: 6,195; makefile: 24
file content (11 lines) | stat: -rw-r--r-- 298 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
unless Kernel.method_defined? :public_method
  module Kernel
    def public_method(meth)
      if respond_to?(meth) && !protected_methods.include?(meth.to_s)
        method(meth)
      else
        raise NameError, "undefined method `#{meth}' for class `#{self.class}'"
      end
    end
  end
end