Questions tagged [yard]

YARD stands for "Yay! A Ruby Documentation tool". It is considered an alternative to the rdoc tool with more features.

YARD stands for "Yay! A Ruby Documentation tool". It is considered an alternative to the rdoc tool with more features. The YARD website says:

YARD is a documentation generation tool for the Ruby programming language. It enables the user to generate consistent, usable documentation that can be exported to a number of formats very easily, and also supports extending for custom Ruby constructs such as custom class level definitions.

YARD's notable features include:

  • Preview as you document
  • Easily customize templates
  • Support your own DSL
  • Extend, extend, extend!

And of course YARD comes with much more functionality, including the ability to serve documentation for gems, the ability to group methods into logical sections, and much more.

195 questions
4
votes
1 answer

possible to use YARD to document erb templates

Is it possible to use YARD to document templates or does it require classes in files? I have tried running yard doc controllers/ models/ views/index/ but the index views aren't picked up. I see the meta data to be added to extra files in the docs…
timpone
  • 19,235
  • 36
  • 121
  • 211
4
votes
1 answer

yard 0.7.3 fails to build my README in both markdown and textile

I've decided to convert the README file in a project of mine to markdown and have been using yard verify the documentation rendered out ok. So I installed rdiscount, changed README to README.md and tried: yard doc README.md which gave me a…
wwest
  • 47
  • 5
4
votes
3 answers

How to prevent [view source] link when creating documentation using yard?

I am using yard to generate project documentation, but i don't want to display the [view source] link in the documentation, i have dived into the yard official guides but still don't get the solution. Anything ideas? Thanks.
rockllei
  • 39
  • 4
4
votes
0 answers

How can Yard document a Ruby method returning the type of the yield block?

I have a method that optionally takes a block. It either returns an array of the parameters it would have supplied to an absent block, or transparently returns the result of yield. I know I can use @overload to treat the block/no-block causes…
Tim Baverstock
  • 415
  • 4
  • 11
4
votes
1 answer

Line continuation in rdoc

I have inherited a bunch of Ruby code with rdoc comments, but many of the options and attributes are multi-line, such as: # +param+:: Here is a parameter with a really long description # that won't fit in one line The end result is really hard to…
robbie.huffman
  • 423
  • 4
  • 12
4
votes
1 answer

Get YARD comments for Ruby objects programmatically

Given the following ruby file, foo.rb: # this is a module comment module A # this is a constant comment B = 'hi' # this is a class comment class C # this is a method comment # @param [String] name Who to say hi to # @return…
dug
  • 2,275
  • 1
  • 18
  • 25
4
votes
1 answer

link to Ruby core class in YARD

In YARD, when the parameter type or return type is a class in the same project, it automatically creates a link to the page of that class. Now I want to do the same to a Ruby core class (or any external class), says Integer. I want YARD to link any…
Franklin Yu
  • 8,920
  • 6
  • 43
  • 57
4
votes
2 answers

Pry gives a bunch of warnings

Requiring pry in my RSpec spec_helper.rb and running my specs gives me a bunch of warnings. How do I get rid of these? /Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/pry/commands/bang.rb:3: warning: ambiguous first argument; put parentheses or even…
niftygrifty
  • 3,452
  • 2
  • 28
  • 49
4
votes
1 answer

How do I prevent Yard from using the contents of @return as description?

I have nothing useful to write about this function other than specifying what it outputs. If Yard doesn't find a description, it uses the contents of @return instead. Is there any way to prevent that? I want to avoid silly duplication like you see…
Hubro
  • 56,214
  • 69
  • 228
  • 381
4
votes
2 answers

axslx: undefined method for yard

I'm running "yard server -g" but it's only generating the Table of Contents for axlsx. When I click on a class I get: undefined method `new' for nil:NilClass. Any idea why? (Fwiw, other gems are working fine in Yard server)
Snowcrash
  • 80,579
  • 89
  • 266
  • 376
4
votes
2 answers

YARD convention for truthiness

Is there a convention to indicate that a parameter in YARD style documentation is only used for its "truthiness" status, that is you only want to know if it's false or nil or is truthy? What is typically put in place of Truthy in the following? #…
Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
4
votes
2 answers

Run Yard Server on Heroku

Is there a way to mount Yard (http://yardoc.org/guides/index.html) server on heroku ? I did not find anything in the doc that explains how to do it. Thanks a lot
mathieurip
  • 547
  • 1
  • 6
  • 16
3
votes
1 answer

How can I state and display documentation related to constant values in a proper way?

I am using Ruby on Rails 3.1.0 and I am trying to use YARD 0.7.4. I would like to document constant values, so in my class I state this: # [Fixnum] Test constant documentation. TEST_CONSTANT = 1 but the HTML output after I run the yardoc (or yard…
user12882
  • 4,702
  • 9
  • 39
  • 54
3
votes
3 answers

How I can run Yard server on production server?

How I can run Yard server on production server? Maybe use some task? Load from capistrano, using passenger and nginx, Jenkins(Hudson).
Mikhail Grishko
  • 4,258
  • 3
  • 22
  • 21
3
votes
1 answer

Macros don't work consistently when generating docs

I am using macros in the YARD doc tool and on some files they work and some they don't. For example, I define a macro in one of my source files. # @macro [new] my_macro # @param [String] my_string it's a string! # def method(my_string) #do…
juan2raid
  • 1,606
  • 1
  • 18
  • 29