def scope=(v)
      reregister = @scope ? true : false

      # handle module function
      if v == :module
        other = self.class.new(namespace, name)
        other.visibility = :private
        @visibility = :public
        @module_function = true
        @path = nil
      end

      YARD::Registry.delete(self)
      @path = nil
      @scope = v.to_sym
      @scope = :class if @scope == :module
      YARD::Registry.register(self) if reregister
    end
def scope=(v)
      reregister = @scope ? true : false

      # handle module function
      if v == :module
        other = self.class.new(namespace, name)
        other.visibility = :private
        @visibility = :public
        @module_function = true
        @path = nil
      end

      YARD::Registry.delete(self)
      @path = nil
      @scope = v.to_sym
      @scope = :class if @scope == :module
      YARD::Registry.register(self) if reregister
    end
Creates a new method object in +namespace+ with +name+ and an instance
 or class +scope+

 If scope is +:module+, this object is instantiated as a public
 method in +:class+ scope, but also creates a new (empty) method
 as a private +:instance+ method on the same class or module.

 @param [NamespaceObject] namespace the namespace
 @param [String, Symbol] name the method name
 @param [Symbol] scope +:instance+, +:class+, or +:module+
 Changes the scope of an object from :instance or :class
 @param [Symbol] v the new scope