lib/yard/code_objects/base.rb in yard-0.9.20 vs lib/yard/code_objects/base.rb in yard-0.9.21

- old
+ new

@@ -187,10 +187,14 @@ # @return [Base] # @see #initialize def new(namespace, name, *args, &block) raise ArgumentError, "invalid empty object name" if name.to_s.empty? if namespace.is_a?(ConstantObject) + unless namespace.value =~ /\A#{NAMESPACEMATCH}\Z/ + raise Parser::UndocumentableError, "constant mapping" + end + namespace = Proxy.new(namespace.namespace, namespace.value) end if name.to_s[0, 2] == NSEP name = name.to_s[2..-1] @@ -380,13 +384,16 @@ # @param [#source, String] statement # the +Parser::Statement+ holding the source code or the raw source # as a +String+ for the definition of the code object only (not the block) def source=(statement) if statement.respond_to?(:source) - self.signature = statement.first_line @source = format_source(statement.source.strip) else @source = format_source(statement.to_s) + end + + if statement.respond_to?(:signature) + self.signature = statement.signature end end # The documentation string associated with the object #