lib/yard/handlers/ruby/legacy/method_handler.rb in yard-0.4.0 vs lib/yard/handlers/ruby/legacy/method_handler.rb in yard-0.5.0
- old
+ new
@@ -27,14 +27,20 @@
o.parameters = args
end
if mscope == :instance && meth == "initialize"
unless obj.has_tag?(:return)
obj.docstring.add_tag(YARD::Tags::Tag.new(:return,
- "a new instance of +#{namespace.name}+", namespace.name.to_s))
+ "a new instance of #{namespace.name}", namespace.name.to_s))
end
elsif mscope == :class && obj.docstring.blank? && %w(inherited included
extended method_added method_removed method_undefined).include?(meth)
obj.docstring.add_tag(YARD::Tags::Tag.new(:private, nil))
+ elsif meth.to_s =~ /\?$/
+ if obj.tag(:return) && (obj.tag(:return).types || []).empty?
+ obj.tag(:return).types = ['Boolean']
+ elsif obj.tag(:return).nil?
+ obj.docstring.add_tag(YARD::Tags::Tag.new(:return, "", "Boolean"))
+ end
end
parse_block(:owner => obj) # mainly for yield/exceptions
end
end