def initialize(namespace, name, type = nil)
namespace = Registry.root if !namespace || namespace == :root
if name =~ /^#{NSEPQ}/
namespace = Registry.root
name = name[2..-1]
end
if name =~ /(?:#{NSEPQ}|#{ISEPQ}|#{CSEPQ})([^#{NSEPQ}#{ISEPQ}#{CSEPQ}]+)$/
@orignamespace, @origname = namespace, name
@imethod = true if name.include? ISEP
namespace = Proxy.new(namespace, $`) unless $`.empty?
name = $1
else
@orignamespace, @origname, @imethod = nil, nil, nil
end
@name = name.to_sym
@namespace = namespace
@obj = nil
@imethod ||= nil
self.type = type
if @namespace.is_a?(ConstantObject)
@origname = nil
@orignamespace = nil
@namespace = Proxy.new(@namespace.namespace, @namespace.value)
end
unless @namespace.is_a?(NamespaceObject) or @namespace.is_a?(Proxy)
raise ArgumentError, "Invalid namespace object: #{namespace}"
end
if @name =~ /^#{NSEPQ}/
@name.gsub!(/^#{NSEPQ}/, '')
@namespace = Registry.root
end
end