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
45
votes
2 answers

How can I list the undocumented modules/classes/constants/methods with yardoc?

I have a small library of code that I am documenting with YARD. When I run the yardoc command, it tells me: Files: 40 Modules: 14 ( 0 undocumented) Classes: 39 ( 0 undocumented) Constants: 21 ( 4…
Jeff Terrell Ph.D.
  • 2,563
  • 26
  • 39
33
votes
1 answer

How do I document Rake tasks with YARD?

I would like to include information on the Rake tasks in our Rails app. We use YARD for documentation, and at the moment pages like lib/tasks/development.rake show up by default as unformatted text. I can make them render as Ruby source code using…
Leo
  • 4,217
  • 4
  • 25
  • 41
32
votes
2 answers

Mark a parameter as optional (or has a default) with YARD

I'm using YARD to document my code. I have a method that has an optional parameter with a default value. How do I notate that the parameter is optional and has a default value? Example: # Squares a number # # @param the number to square def…
brainimus
  • 10,586
  • 12
  • 42
  • 64
30
votes
1 answer

yard and links to classes/modules in the doc

I'm currently switching from rdoc to yard for my ruby software documentaion. In my doc I often reference some classes/modules from the comments, for instance : ## == Provides various utility features ## ## == Features ## ## Logging : logging is…
devlearn
  • 1,725
  • 2
  • 17
  • 30
29
votes
1 answer

How should I provide YARD/RDoc documentation for Ruby keyword arguments?

For a basic Ruby method, I would provide YARD style doc for parameters in the following format. # @param query [String] The search string to query. # @param options [Hash] Optional search preferences. def search(query, options = {}) #…
Matt Huggins
  • 81,398
  • 36
  • 149
  • 218
25
votes
1 answer

YARD is not the same as RDoc?

Correct me if I'm wrong, is YARD not the same as RDoc? It's not based on RDoc but a total rewrite? So if I'm using YARD, I don't have to bother with RDoc right?
never_had_a_name
  • 90,630
  • 105
  • 267
  • 383
25
votes
3 answers

Is it normal that YARD doesn't replace `code` with code?

I'm just starting to use YARD for documenting my Rails app. I didn't specify any specific Markup handler, but I would have expected that `code` would be converted to code, which doesn't seem to happen. Is this normal behavior? Do I have to add some…
Joshua Muheim
  • 12,617
  • 9
  • 76
  • 152
17
votes
2 answers

Document model attributes with YARD

I'm using YARD to generate docs for my rails app with makrdown as the script parser. Most of the documentation features just work great right out of the box. However, I'd also like to document the model attributes to one, record the list of…
Paul Alexander
  • 31,970
  • 14
  • 96
  • 151
15
votes
2 answers

How to rebuild rdoc for all the installed gems?

I have several gems installed in multiple locations. What is the hard/easy way to generate/re-generate: rdoc for all these installed gems, all at once? yardoc for all these installed gems, all at once?
Dharam Gollapudi
  • 6,328
  • 2
  • 34
  • 42
15
votes
2 answers

Limitations of PEG grammar & parser generators?

I was enjoying using YARD a lot: http://www.ootl.org/yard/ http://code.google.com/p/yardparser/ http://www.codeproject.com/KB/recipes/yard-tokenizer.aspx I was able to construct fully functional calculator. I'm evaluating YARD to do PHP parser.…
Viet
  • 17,944
  • 33
  • 103
  • 135
12
votes
1 answer

Best way to document "splatted" parameter with YARD?

I have a method that should take 1+ parameters of any class, similar to Array#push: def my_push(*objects) raise ArgumentError, 'Needs 1+ arguments' if objects.empty? objects.each do |obj| puts "An object was pushed: #{obj.inspect}" …
hololeap
  • 1,156
  • 13
  • 20
12
votes
1 answer

Yard relative link to extra file

I want to link to another extra file from my README using Yard. For example, I have the following line: ...detailed instructions [here](contributing.md) on how to contribute I want this to link to my file contributing.md in the same…
hackyday
  • 1,279
  • 8
  • 12
12
votes
1 answer

How to YARD document a method that returns nothing

I have a method like this def self.import(file_name, opts = {}) which I'm trying to document with YARD. However this is a method which is 100% side effect (I know, I know, side effects, urgh!). But for users of this method there is effectively no…
Jamie Cook
  • 4,375
  • 3
  • 42
  • 53
11
votes
1 answer

YARD: documenting class methods added by an included module

I am writing documentation for my ruby gem using YARD. In my gem, I have some code which follows this common ruby pattern where a module is included in a class, and that module not only adds instance methods but it also adds class methods: module…
David Grayson
  • 84,103
  • 24
  • 152
  • 189
11
votes
2 answers

How to document AngularJS + Ruby on Rails app?

I'm using yard to generate my documentation for Rails apps from an rdoc file. There are AngularJS documentation generators, but how could they be connected to generate one coherent document for an AngularJS + Rails app?
helcim
  • 789
  • 13
  • 27
1
2 3
12 13