lib/yard/handlers/ruby/method_handler.rb in yard-0.8.3 vs lib/yard/handlers/ruby/method_handler.rb in yard-0.8.4
- old
+ new
@@ -27,35 +27,35 @@
nobj.aliases.each do |aobj, name|
next unless name == obj.name
nobj.aliases.delete(aobj)
end if nobj.is_a?(NamespaceObject)
- if mscope == :instance && meth == "initialize"
+ if obj.constructor?
unless obj.has_tag?(:return)
- obj.docstring.add_tag(YARD::Tags::Tag.new(:return,
+ obj.add_tag(YARD::Tags::Tag.new(:return,
"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))
+ obj.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?
unless obj.tags(:overload).any? {|overload| overload.tag(:return) }
- obj.docstring.add_tag(YARD::Tags::Tag.new(:return, "", "Boolean"))
+ obj.add_tag(YARD::Tags::Tag.new(:return, "", "Boolean"))
end
end
end
if obj.has_tag?(:option)
# create the options parameter if its missing
obj.tags(:option).each do |option|
expected_param = option.name
unless obj.tags(:param).find {|x| x.name == expected_param }
new_tag = YARD::Tags::Tag.new(:param, "a customizable set of options", "Hash", expected_param)
- obj.docstring.add_tag(new_tag)
+ obj.add_tag(new_tag)
end
end
end
if info = obj.attr_info
@@ -86,6 +86,6 @@
"def #{method_name}(#{statement.parameters.source})"
else
"def #{method_name}"
end
end
-end
\ No newline at end of file
+end