lib/yard/handlers/ruby/constant_handler.rb in yard-0.9.0 vs lib/yard/handlers/ruby/constant_handler.rb in yard-0.9.1
- old
+ new
@@ -16,10 +16,15 @@
private
def process_constant(statement)
name = statement[0][0][0]
value = statement[1].source
- register ConstantObject.new(namespace, name) {|o| o.source = statement; o.value = value.strip }
+ obj = P(namespace, name)
+ if obj.is_a?(NamespaceObject)
+ raise YARD::Parser::UndocumentableError, "constant for existing #{obj.type} #{obj}"
+ else
+ register ConstantObject.new(namespace, name) {|o| o.source = statement; o.value = value.strip }
+ end
end
def process_structclass(statement)
lhs = statement[0][0]
if lhs.type == :const