Method: YARD::Docstring#dup

Defined in:
lib/yard/docstring.rb

#dupDocstring

Note:

This method creates a new docstring with new tag lists, but does not create new individual tags. Modifying the tag objects will still affect the original tags.

Deep-copies a docstring

Returns:

Since:

  • 0.7.0

[View source]

86
87
88
89
90
91
92
93
# File 'lib/yard/docstring.rb', line 86

def dup
  obj = super
  %w(all summary tags ref_tags).each do |name|
    val = instance_variable_get("@#{name}")
    obj.instance_variable_set("@#{name}", val ? val.dup : nil)
  end
  obj
end