Class UndefinedMethod

java.lang.Object
org.jruby.internal.runtime.methods.DynamicMethod
org.jruby.internal.runtime.methods.UndefinedMethod

public final class UndefinedMethod extends DynamicMethod
This class represents a singleton type of method used as a marker for missing or "undef'ed" methods. Only one instance is ever created, and it can't be invoked.
  • Field Details

  • Method Details

    • call

      public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject[] args, Block block)
      The one implementation of call, which throws an exception because UndefinedMethod can't be invoked.
      Specified by:
      call in class DynamicMethod
      Parameters:
      context - The thread context for the currently executing thread
      self - The 'self' or 'receiver' object to use for this call
      klazz - The Ruby class against which this method is binding
      name - The incoming name used to invoke this method
      args - The argument list to this invocation
      block - The block passed to this invocation
      Returns:
      The result of the call
      Throws:
      UnsupportedOperationException
      See Also:
    • dup

      public DynamicMethod dup()
      A dummy implementation of dup that just returns the singleton instance.
      Specified by:
      dup in class DynamicMethod
      Returns:
      The singleton instance
    • getInstance

      public static UndefinedMethod getInstance()
      Retrieve the singleton instance.
      Returns:
      The singleton instance
    • setImplementationClass

      public void setImplementationClass(RubyModule implClass)
      Dummy override of setImplementationClass that does nothing.
      Overrides:
      setImplementationClass in class DynamicMethod
      Parameters:
      implClass - Ignored
    • setDefinedClass

      public void setDefinedClass(RubyModule definedClass)
      Description copied from class: DynamicMethod
      Set the defining class for this method, as when restructuring hierarchy for prepend.
      Overrides:
      setDefinedClass in class DynamicMethod
      Parameters:
      definedClass - that method was defined in
    • getVisibility

      public Visibility getVisibility()
      UndefinedMethod is always visibility UNDEFINED
      Overrides:
      getVisibility in class DynamicMethod
      Returns:
      The visibility of this method
    • setVisibility

      public void setVisibility(Visibility visibility)
      Dummy implementation of setVisibility that does nothing.
      Overrides:
      setVisibility in class DynamicMethod
      Parameters:
      visibility - Ignored
    • setIsBuiltin

      public void setIsBuiltin(boolean isBuiltin)
      Description copied from class: DynamicMethod
      Force this method to be treated as a core built-in method if true, or as a normal non-core method otherwise.
      Overrides:
      setIsBuiltin in class DynamicMethod
      Parameters:
      isBuiltin - true if this is a core built-in method, false otherwise
    • setNotImplemented

      public void setNotImplemented(boolean setNotImplemented)
      Description copied from class: DynamicMethod
      Set whether this method is "not implemented".
      Overrides:
      setNotImplemented in class DynamicMethod
      Parameters:
      setNotImplemented - is this not implement or not
    • isCallableFrom

      public boolean isCallableFrom(IRubyObject caller, CallType callType)
      UndefinedMethod is always visible because it's only used as a marker for missing or undef'ed methods.
      Overrides:
      isCallableFrom in class DynamicMethod
      Parameters:
      caller - The calling object
      callType - The type of call
      Returns:
      true always