Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7859105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:46:50+00:00 2026-06-02T21:46:50+00:00

I am documenting a project and essientially I have something similar to the following:

  • 0

I am documenting a project and essientially I have something similar to the following:

def foo
  return bar(__method__)
end

def bar (method)
 return method.to_s + 'somestring'
end

I am setting up a multitude of methods similar to how I have implemented foo where they are they are returning the return of bar. An example is as follows:

# The descriptions for foo0...
# @return [String] the method name concatenated with somestring
def foo0
  return bar(__method__)
end
# The descriptions for foo1...
# @return [String] the method name concatenated with somestring
def foo1
  return bar(__method__)
end

# The descriptions for bar...
# @return [String] the method name concatenated with somestring
def bar (method)
 return method.to_s + 'somestring'
end

But say I change what bar is returning to an integer then my documentation is incorrect. I familiar with documenting DSLs in YARD but how do you just specify #bar@return.type the return type of The return of method bar when describing another method. An example of what I am referring to is as follows:

# The descriptions for foo0...
# @return [#bar@return.type] the method name concatenated with somestring
def foo0
  return bar(__method__)
end
# The descriptions for foo1...
# @return [#bar@return.type] the method name concatenated with somestring
def foo1
  return bar(__method__)
end

# The descriptions for bar...
# @return [String] the method name concatenated with somestring
def bar (method)
 return method.to_s + 'somestring'
end

Ultimately what I am trying to accomplish is to document my code without having to define absolutes like a return type which are dependent on what another method is defined to be.

UPDATE:
I have discovered that you are able to call # @return (see #bar) and have it list the return or the foo methods the same as bar methods but I am unable to determine how to simple get the type which is being returned and/or overload the description of the return for bar with a custom description for foo.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T21:46:52+00:00Added an answer on June 2, 2026 at 9:46 pm

    As you discovered, you should use @return (see #bar) to copy the @return tag from #bar verbatim to the other docstrings. Note: it will copy the description text too. There’s no way to just interpolate the type of a method. You don’t seem to need it in your specific example, though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My team and I have found that documenting our project (a development platform w/
I have been documenting myself about stacks, queues and deques for a small project.
In documenting a Python function, I find it more Pythonic to say: def Foo(i):
I am using Sphinx with autodoc for documenting my Django project. Design guys want
When investigating effective methods of documenting our VB .NET project, by experimentation I discovered
I am trying to use the following script by duckrowing ( http://www.duckrowing.com/2010/03/18/documenting-objective-c-with-doxygen-part-ii/ ), to
I'm in the process of documenting a Ruby project with rdoc, and I discovered
I wrote custom FxCop rules for our project. I wrote a wiki page documenting
We all have the good habit of documenting our code, right? Nowadays, in-code documentation
Hi I have 2 tables Document and Project. DocumentID is an FK in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.