yard 0.2.3.5 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of yard might be problematic. Click here for more details.

Files changed (365) hide show
  1. data/.yardopts +12 -10
  2. data/ChangeLog +5686 -0
  3. data/{README.markdown → README.md} +65 -11
  4. data/Rakefile +25 -13
  5. data/benchmarks/concat_vs_join.rb +12 -0
  6. data/benchmarks/erb_vs_erubis.rb +14 -14
  7. data/benchmarks/marshal_vs_dbm.rb +1 -1
  8. data/benchmarks/pathname_vs_string.rb +50 -0
  9. data/benchmarks/template_erb.rb +22 -0
  10. data/benchmarks/template_format.rb +6 -0
  11. data/benchmarks/template_profile.rb +17 -0
  12. data/bin/yri +16 -7
  13. data/docs/{CODE_OBJECTS.markdown → CodeObjects.md} +0 -0
  14. data/docs/{GETTING_STARTED.markdown → GettingStarted.md} +49 -11
  15. data/docs/{GLOSSARY.markdown → Glossary.md} +0 -0
  16. data/docs/{HANDLERS.markdown → Handlers.md} +5 -5
  17. data/docs/{OVERVIEW.markdown → Overview.md} +9 -13
  18. data/docs/{PARSER.markdown → Parser.md} +1 -1
  19. data/docs/{TAGS.markdown → Tags.md} +1 -1
  20. data/docs/Templates.md +286 -0
  21. data/docs/{WHATSNEW.markdown → WhatsNew.md} +82 -2
  22. data/lib/rubygems_plugin.rb +17 -20
  23. data/lib/yard.rb +47 -1
  24. data/lib/yard/autoload.rb +38 -47
  25. data/lib/yard/cli/yard_graph.rb +36 -13
  26. data/lib/yard/cli/yardoc.rb +74 -12
  27. data/lib/yard/code_objects/base.rb +182 -14
  28. data/lib/yard/code_objects/class_object.rb +39 -2
  29. data/lib/yard/code_objects/class_variable_object.rb +4 -0
  30. data/lib/yard/code_objects/constant_object.rb +8 -0
  31. data/lib/yard/code_objects/extended_method_object.rb +14 -0
  32. data/lib/yard/code_objects/method_object.rb +60 -2
  33. data/lib/yard/code_objects/module_object.rb +6 -0
  34. data/lib/yard/code_objects/namespace_object.rb +99 -2
  35. data/lib/yard/code_objects/proxy.rb +53 -6
  36. data/lib/yard/code_objects/root_object.rb +2 -0
  37. data/lib/yard/core_ext/array.rb +61 -0
  38. data/lib/yard/core_ext/file.rb +21 -4
  39. data/lib/yard/core_ext/module.rb +11 -1
  40. data/lib/yard/core_ext/string.rb +13 -2
  41. data/lib/yard/core_ext/symbol_hash.rb +51 -3
  42. data/lib/yard/docstring.rb +68 -19
  43. data/lib/yard/globals.rb +5 -2
  44. data/lib/yard/handlers/base.rb +13 -3
  45. data/lib/yard/handlers/processor.rb +64 -2
  46. data/lib/yard/handlers/ruby/class_handler.rb +1 -1
  47. data/lib/yard/handlers/ruby/class_variable_handler.rb +5 -1
  48. data/lib/yard/handlers/ruby/constant_handler.rb +38 -4
  49. data/lib/yard/handlers/ruby/exception_handler.rb +1 -0
  50. data/lib/yard/handlers/ruby/legacy/base.rb +2 -2
  51. data/lib/yard/handlers/ruby/legacy/class_variable_handler.rb +6 -3
  52. data/lib/yard/handlers/ruby/legacy/constant_handler.rb +21 -2
  53. data/lib/yard/handlers/ruby/legacy/method_handler.rb +10 -0
  54. data/lib/yard/handlers/ruby/legacy/yield_handler.rb +2 -1
  55. data/lib/yard/handlers/ruby/method_handler.rb +10 -0
  56. data/lib/yard/handlers/ruby/yield_handler.rb +2 -1
  57. data/lib/yard/logging.rb +17 -0
  58. data/lib/yard/parser/ruby/ast_node.rb +101 -0
  59. data/lib/yard/parser/ruby/legacy/ruby_lex.rb +2 -2
  60. data/lib/yard/parser/ruby/legacy/statement_list.rb +10 -9
  61. data/lib/yard/parser/ruby/ruby_parser.rb +32 -3
  62. data/lib/yard/parser/source_parser.rb +82 -5
  63. data/lib/yard/rake/yardoc_task.rb +38 -3
  64. data/lib/yard/registry.rb +112 -2
  65. data/lib/yard/serializers/base.rb +48 -1
  66. data/lib/yard/serializers/file_system_serializer.rb +23 -2
  67. data/lib/yard/serializers/process_serializer.rb +10 -0
  68. data/lib/yard/serializers/stdout_serializer.rb +11 -0
  69. data/lib/yard/tags/library.rb +4 -1
  70. data/lib/yard/tags/overload_tag.rb +3 -12
  71. data/lib/yard/templates/engine.rb +162 -0
  72. data/lib/yard/{generators → templates}/helpers/base_helper.rb +14 -13
  73. data/lib/yard/{generators → templates}/helpers/filter_helper.rb +1 -1
  74. data/lib/yard/templates/helpers/html_helper.rb +287 -0
  75. data/lib/yard/templates/helpers/html_syntax_highlight_helper.rb +29 -0
  76. data/lib/yard/templates/helpers/html_syntax_highlight_helper18.rb +27 -0
  77. data/lib/yard/{generators → templates}/helpers/markup_helper.rb +15 -11
  78. data/lib/yard/{generators → templates}/helpers/method_helper.rb +8 -1
  79. data/lib/yard/templates/helpers/module_helper.rb +15 -0
  80. data/lib/yard/templates/helpers/text_helper.rb +60 -0
  81. data/lib/yard/templates/helpers/uml_helper.rb +33 -0
  82. data/lib/yard/templates/template.rb +355 -0
  83. data/lib/yard/verifier.rb +110 -0
  84. data/spec/cli/yardoc_spec.rb +23 -1
  85. data/spec/code_objects/base_spec.rb +8 -0
  86. data/spec/code_objects/class_object_spec.rb +166 -156
  87. data/spec/code_objects/method_object_spec.rb +2 -2
  88. data/spec/code_objects/module_object_spec.rb +112 -110
  89. data/spec/code_objects/proxy_spec.rb +9 -0
  90. data/spec/core_ext/array_spec.rb +33 -0
  91. data/spec/core_ext/file_spec.rb +40 -12
  92. data/spec/core_ext/module_spec.rb +15 -0
  93. data/spec/core_ext/string_spec.rb +10 -2
  94. data/spec/docstring_spec.rb +157 -135
  95. data/spec/handlers/class_handler_spec.rb +3 -0
  96. data/spec/handlers/class_variable_handler_spec.rb +3 -1
  97. data/spec/handlers/constant_handler_spec.rb +38 -0
  98. data/spec/handlers/examples/class_handler_001.rb.txt +14 -1
  99. data/spec/handlers/examples/class_variable_handler_001.rb.txt +1 -0
  100. data/spec/handlers/examples/constant_handler_001.rb.txt +10 -1
  101. data/spec/handlers/examples/exception_handler_001.rb.txt +5 -0
  102. data/spec/handlers/examples/method_handler_001.rb.txt +15 -0
  103. data/spec/handlers/examples/mixin_handler_001.rb.txt +13 -0
  104. data/spec/handlers/exception_handler_spec.rb +4 -0
  105. data/spec/handlers/method_handler_spec.rb +22 -0
  106. data/spec/handlers/mixin_handler_spec.rb +5 -3
  107. data/spec/handlers/yield_handler_spec.rb +1 -1
  108. data/spec/parser/ruby/ast_node_spec.rb +16 -0
  109. data/spec/parser/ruby/legacy/statement_list_spec.rb +36 -0
  110. data/spec/parser/ruby/ruby_parser_spec.rb +80 -0
  111. data/spec/parser/source_parser_spec.rb +48 -2
  112. data/spec/rake/yardoc_task_spec.rb +62 -25
  113. data/spec/serializers/file_system_serializer_spec.rb +1 -1
  114. data/spec/templates/class_spec.rb +34 -0
  115. data/spec/templates/engine_spec.rb +121 -0
  116. data/spec/templates/examples/class001.html +271 -0
  117. data/spec/templates/examples/class001.txt +31 -0
  118. data/spec/templates/examples/method001.html +96 -0
  119. data/spec/templates/examples/method001.txt +28 -0
  120. data/spec/templates/examples/method002.html +81 -0
  121. data/spec/templates/examples/method002.txt +20 -0
  122. data/spec/templates/examples/method003.html +137 -0
  123. data/spec/templates/examples/method003.txt +45 -0
  124. data/spec/templates/examples/module001.dot +31 -0
  125. data/spec/templates/examples/module001.html +294 -0
  126. data/spec/templates/examples/module001.txt +33 -0
  127. data/spec/templates/examples/tag001.txt +82 -0
  128. data/spec/templates/helpers/base_helper_spec.rb +129 -0
  129. data/spec/{generators → templates}/helpers/html_helper_spec.rb +73 -16
  130. data/spec/templates/helpers/html_syntax_highlight_helper_spec.rb +39 -0
  131. data/spec/{generators → templates}/helpers/markup_helper_spec.rb +6 -7
  132. data/spec/templates/method_spec.rb +75 -0
  133. data/spec/templates/module_spec.rb +50 -0
  134. data/spec/templates/spec_helper.rb +33 -0
  135. data/spec/templates/tag_spec.rb +39 -0
  136. data/spec/templates/template_spec.rb +398 -0
  137. data/spec/verifier_spec.rb +51 -0
  138. data/spec/yard_spec.rb +46 -0
  139. data/templates/default/class/dot/setup.rb +6 -0
  140. data/templates/default/class/dot/superklass.erb +3 -0
  141. data/templates/default/class/html/constructor_details.erb +8 -0
  142. data/templates/default/class/html/setup.rb +1 -0
  143. data/templates/default/class/html/subclasses.erb +4 -0
  144. data/templates/default/class/setup.rb +29 -0
  145. data/templates/default/class/text/setup.rb +11 -0
  146. data/templates/default/class/text/subclasses.erb +5 -0
  147. data/templates/default/docstring/html/abstract.erb +4 -0
  148. data/templates/default/docstring/html/deprecated.erb +1 -0
  149. data/templates/default/docstring/html/index.erb +5 -0
  150. data/templates/default/docstring/html/note.erb +6 -0
  151. data/templates/default/docstring/html/text.erb +1 -0
  152. data/templates/default/docstring/html/todo.erb +6 -0
  153. data/templates/default/docstring/setup.rb +39 -0
  154. data/templates/default/docstring/text/abstract.erb +2 -0
  155. data/templates/default/docstring/text/deprecated.erb +2 -0
  156. data/templates/default/docstring/text/index.erb +2 -0
  157. data/templates/default/docstring/text/note.erb +4 -0
  158. data/templates/default/docstring/text/text.erb +1 -0
  159. data/templates/default/docstring/text/todo.erb +4 -0
  160. data/templates/default/fulldoc/html/css/common.css +1 -0
  161. data/templates/default/fulldoc/html/css/full_list.css +23 -0
  162. data/templates/default/fulldoc/html/css/style.css +261 -0
  163. data/templates/default/fulldoc/html/full_list.erb +36 -0
  164. data/templates/default/fulldoc/html/js/app.js +91 -0
  165. data/templates/default/fulldoc/html/js/full_list.js +39 -0
  166. data/templates/default/fulldoc/html/js/jquery.js +19 -0
  167. data/templates/default/fulldoc/html/setup.rb +86 -0
  168. data/templates/default/{uml → layout}/dot/header.erb +2 -2
  169. data/templates/default/layout/dot/setup.rb +14 -0
  170. data/templates/default/layout/html/breadcrumb.erb +11 -0
  171. data/templates/default/layout/html/footer.erb +5 -0
  172. data/templates/default/layout/html/headers.erb +13 -0
  173. data/templates/default/layout/html/index.erb +49 -0
  174. data/templates/default/layout/html/layout.erb +20 -0
  175. data/templates/default/layout/html/search.erb +5 -0
  176. data/templates/default/layout/html/setup.rb +58 -0
  177. data/templates/default/method/html/header.erb +14 -3
  178. data/templates/default/method/setup.rb +3 -0
  179. data/templates/default/method/text/header.erb +1 -1
  180. data/templates/default/method_details/html/header.erb +3 -0
  181. data/templates/default/method_details/html/method_signature.erb +17 -0
  182. data/templates/default/method_details/html/source.erb +10 -0
  183. data/templates/default/method_details/setup.rb +8 -0
  184. data/templates/default/method_details/text/header.erb +10 -0
  185. data/templates/default/method_details/text/method_signature.erb +12 -0
  186. data/templates/default/method_details/text/setup.rb +10 -0
  187. data/templates/default/module/dot/child.erb +1 -0
  188. data/templates/default/module/dot/dependencies.erb +3 -0
  189. data/templates/default/{uml/dot/subgraph.erb → module/dot/header.erb} +3 -3
  190. data/templates/default/{uml → module}/dot/info.erb +4 -4
  191. data/templates/default/module/dot/setup.rb +14 -0
  192. data/templates/default/module/html/attribute_details.erb +11 -0
  193. data/templates/default/module/html/attribute_summary.erb +8 -0
  194. data/templates/default/module/html/box_info.erb +32 -0
  195. data/templates/default/module/html/children.erb +8 -0
  196. data/templates/default/module/html/constant_summary.erb +13 -0
  197. data/templates/default/module/html/defines.erb +3 -0
  198. data/templates/default/module/html/header.erb +4 -4
  199. data/templates/default/module/html/inherited_constants.erb +8 -0
  200. data/templates/default/module/html/inherited_methods.erb +9 -0
  201. data/templates/default/module/html/item_summary.erb +20 -0
  202. data/templates/default/module/html/method_details_list.erb +8 -0
  203. data/templates/default/module/html/method_summary.erb +8 -0
  204. data/templates/default/module/html/methodmissing.erb +12 -0
  205. data/templates/default/module/html/pre_docstring.erb +1 -0
  206. data/templates/default/module/setup.rb +83 -0
  207. data/templates/default/module/text/children.erb +10 -0
  208. data/templates/default/module/text/class_meths_list.erb +8 -0
  209. data/templates/default/module/text/extends.erb +8 -0
  210. data/templates/default/module/text/header.erb +7 -0
  211. data/templates/default/module/text/includes.erb +8 -0
  212. data/templates/default/module/text/instance_meths_list.erb +8 -0
  213. data/templates/default/module/text/setup.rb +12 -0
  214. data/templates/default/root/dot/child.erb +3 -0
  215. data/templates/default/root/dot/setup.rb +5 -0
  216. data/templates/default/tags/html/example.erb +5 -16
  217. data/templates/default/tags/html/index.erb +3 -0
  218. data/templates/default/tags/html/option.erb +17 -20
  219. data/templates/default/tags/html/overload.erb +13 -0
  220. data/templates/default/tags/html/see.erb +5 -10
  221. data/templates/default/tags/html/tag.erb +20 -0
  222. data/templates/default/tags/setup.rb +50 -0
  223. data/templates/default/tags/text/example.erb +8 -10
  224. data/templates/default/tags/text/index.erb +1 -0
  225. data/templates/default/tags/text/option.erb +18 -3
  226. data/templates/default/tags/text/overload.erb +19 -0
  227. data/templates/default/tags/text/see.erb +8 -2
  228. data/templates/default/tags/text/tag.erb +13 -0
  229. metadata +142 -158
  230. data/bin/view_generator +0 -17
  231. data/docs/FAQ.markdown +0 -34
  232. data/docs/GENERATORS.markdown +0 -211
  233. data/lib/yard/generators/attributes_generator.rb +0 -22
  234. data/lib/yard/generators/base.rb +0 -305
  235. data/lib/yard/generators/class_generator.rb +0 -27
  236. data/lib/yard/generators/constants_generator.rb +0 -74
  237. data/lib/yard/generators/constructor_generator.rb +0 -25
  238. data/lib/yard/generators/deprecated_generator.rb +0 -15
  239. data/lib/yard/generators/docstring_generator.rb +0 -15
  240. data/lib/yard/generators/full_doc_generator.rb +0 -127
  241. data/lib/yard/generators/helpers/html_helper.rb +0 -196
  242. data/lib/yard/generators/helpers/html_syntax_highlight_helper.rb +0 -49
  243. data/lib/yard/generators/helpers/uml_helper.rb +0 -16
  244. data/lib/yard/generators/inheritance_generator.rb +0 -16
  245. data/lib/yard/generators/method_details_generator.rb +0 -18
  246. data/lib/yard/generators/method_generator.rb +0 -43
  247. data/lib/yard/generators/method_listing_generator.rb +0 -105
  248. data/lib/yard/generators/method_missing_generator.rb +0 -25
  249. data/lib/yard/generators/method_signature_generator.rb +0 -19
  250. data/lib/yard/generators/method_summary_generator.rb +0 -21
  251. data/lib/yard/generators/mixins_generator.rb +0 -21
  252. data/lib/yard/generators/module_generator.rb +0 -23
  253. data/lib/yard/generators/overloads_generator.rb +0 -20
  254. data/lib/yard/generators/quick_doc_generator.rb +0 -25
  255. data/lib/yard/generators/root_generator.rb +0 -32
  256. data/lib/yard/generators/source_generator.rb +0 -11
  257. data/lib/yard/generators/tags_generator.rb +0 -99
  258. data/lib/yard/generators/uml_generator.rb +0 -102
  259. data/lib/yard/generators/visibility_group_generator.rb +0 -26
  260. data/spec/generators/base_spec.rb +0 -64
  261. data/spec/generators/full_doc_generator_spec.rb +0 -29
  262. data/spec/generators/helpers/base_helper_spec.rb +0 -15
  263. data/spec/generators/quick_doc_generator_spec.rb +0 -13
  264. data/templates/default/attributes/html/header.erb +0 -47
  265. data/templates/default/attributes/text/header.erb +0 -10
  266. data/templates/default/class/html/header.erb +0 -4
  267. data/templates/default/constants/html/constants.erb +0 -9
  268. data/templates/default/constants/html/header.erb +0 -3
  269. data/templates/default/constants/html/included.erb +0 -9
  270. data/templates/default/constants/html/inherited.erb +0 -9
  271. data/templates/default/constructor/html/header.erb +0 -10
  272. data/templates/default/deprecated/html/main.erb +0 -6
  273. data/templates/default/deprecated/text/main.erb +0 -3
  274. data/templates/default/docstring/html/main.erb +0 -3
  275. data/templates/default/docstring/text/main.erb +0 -3
  276. data/templates/default/fulldoc/html/all_files.erb +0 -19
  277. data/templates/default/fulldoc/html/all_methods.erb +0 -26
  278. data/templates/default/fulldoc/html/all_namespaces.erb +0 -22
  279. data/templates/default/fulldoc/html/app.js +0 -18
  280. data/templates/default/fulldoc/html/custom.css +0 -1
  281. data/templates/default/fulldoc/html/file.erb +0 -16
  282. data/templates/default/fulldoc/html/footer.erb +0 -5
  283. data/templates/default/fulldoc/html/header.erb +0 -16
  284. data/templates/default/fulldoc/html/html_head.erb +0 -4
  285. data/templates/default/fulldoc/html/index.erb +0 -19
  286. data/templates/default/fulldoc/html/jquery.js +0 -11
  287. data/templates/default/fulldoc/html/style.css +0 -81
  288. data/templates/default/fulldoc/html/syntax_highlight.css +0 -24
  289. data/templates/default/inheritance/html/header.erb +0 -8
  290. data/templates/default/inheritance/text/header.erb +0 -3
  291. data/templates/default/method/html/aliases.erb +0 -6
  292. data/templates/default/method/html/title.erb +0 -3
  293. data/templates/default/method/text/title.erb +0 -1
  294. data/templates/default/methoddetails/html/header.erb +0 -8
  295. data/templates/default/methoddetails/html/method_header.erb +0 -3
  296. data/templates/default/methodmissing/html/header.erb +0 -12
  297. data/templates/default/methodsignature/html/main.erb +0 -10
  298. data/templates/default/methodsignature/text/main.erb +0 -8
  299. data/templates/default/methodsummary/html/header.erb +0 -5
  300. data/templates/default/methodsummary/html/included.erb +0 -9
  301. data/templates/default/methodsummary/html/inherited.erb +0 -9
  302. data/templates/default/methodsummary/html/summary.erb +0 -29
  303. data/templates/default/methodsummary/text/header.erb +0 -5
  304. data/templates/default/methodsummary/text/included.erb +0 -0
  305. data/templates/default/methodsummary/text/inherited.erb +0 -0
  306. data/templates/default/methodsummary/text/summary.erb +0 -6
  307. data/templates/default/mixins/html/header.erb +0 -4
  308. data/templates/default/overloads/html/header.erb +0 -8
  309. data/templates/default/overloads/text/header.erb +0 -8
  310. data/templates/default/quickdoc/html/header.erb +0 -15
  311. data/templates/default/quickdoc/text/header.erb +0 -12
  312. data/templates/default/root/html/header.erb +0 -4
  313. data/templates/default/source/html/main.erb +0 -15
  314. data/templates/default/source/text/main.erb +0 -4
  315. data/templates/default/tags/html/header.erb +0 -4
  316. data/templates/default/tags/html/param.erb +0 -21
  317. data/templates/default/tags/html/tags.erb +0 -23
  318. data/templates/default/tags/html/todo.erb +0 -8
  319. data/templates/default/tags/text/header.erb +0 -3
  320. data/templates/default/tags/text/param.erb +0 -9
  321. data/templates/default/tags/text/tags.erb +0 -7
  322. data/templates/default/uml/dot/child.erb +0 -1
  323. data/templates/default/uml/dot/dependencies.erb +0 -10
  324. data/templates/default/uml/dot/superclasses.erb +0 -9
  325. data/templates/default/uml/dot/unknown.erb +0 -3
  326. data/templates/default/uml/dot/unknown_child.erb +0 -1
  327. data/templates/default/visibilitygroup/html/header.erb +0 -6
  328. data/templates/javadoc/attributes/html/header.erb +0 -16
  329. data/templates/javadoc/class/html/header.erb +0 -4
  330. data/templates/javadoc/constants/html/constants.erb +0 -9
  331. data/templates/javadoc/constants/html/header.erb +0 -3
  332. data/templates/javadoc/constants/html/included.erb +0 -12
  333. data/templates/javadoc/constants/html/inherited.erb +0 -12
  334. data/templates/javadoc/constructor/html/header.erb +0 -10
  335. data/templates/javadoc/deprecated/html/main.erb +0 -0
  336. data/templates/javadoc/docstring/html/main.erb +0 -6
  337. data/templates/javadoc/fulldoc/html/all_methods.erb +0 -25
  338. data/templates/javadoc/fulldoc/html/all_namespaces.erb +0 -19
  339. data/templates/javadoc/fulldoc/html/app.js +0 -18
  340. data/templates/javadoc/fulldoc/html/header.erb +0 -15
  341. data/templates/javadoc/fulldoc/html/html_head.erb +0 -3
  342. data/templates/javadoc/fulldoc/html/index.erb +0 -18
  343. data/templates/javadoc/fulldoc/html/jquery.js +0 -11
  344. data/templates/javadoc/fulldoc/html/readme.erb +0 -15
  345. data/templates/javadoc/fulldoc/html/style.css +0 -22
  346. data/templates/javadoc/fulldoc/html/syntax_highlight.css +0 -21
  347. data/templates/javadoc/inheritance/html/header.erb +0 -6
  348. data/templates/javadoc/method/html/aliases.erb +0 -6
  349. data/templates/javadoc/method/html/header.erb +0 -4
  350. data/templates/javadoc/method/html/title.erb +0 -4
  351. data/templates/javadoc/methoddetails/html/header.erb +0 -8
  352. data/templates/javadoc/methoddetails/html/method_header.erb +0 -0
  353. data/templates/javadoc/methodmissing/html/header.erb +0 -12
  354. data/templates/javadoc/methodsignature/html/main.erb +0 -8
  355. data/templates/javadoc/methodsummary/html/header.erb +0 -5
  356. data/templates/javadoc/methodsummary/html/included.erb +0 -12
  357. data/templates/javadoc/methodsummary/html/inherited.erb +0 -12
  358. data/templates/javadoc/methodsummary/html/summary.erb +0 -25
  359. data/templates/javadoc/mixins/html/header.erb +0 -5
  360. data/templates/javadoc/module/html/header.erb +0 -4
  361. data/templates/javadoc/source/html/main.erb +0 -15
  362. data/templates/javadoc/tags/html/header.erb +0 -5
  363. data/templates/javadoc/tags/html/see.erb +0 -8
  364. data/templates/javadoc/tags/html/tags.erb +0 -19
  365. data/templates/javadoc/visibilitygroup/html/header.erb +0 -5
@@ -1,10 +1,20 @@
1
1
  module YARD
2
2
  module CodeObjects
3
+ # A list of code objects. This array acts like a set (no unique items)
4
+ # but also disallows any {Proxy} objects from being added.
3
5
  class CodeObjectList < Array
6
+ # Creates a new object list associated with a namespace
7
+ #
8
+ # @param [NamespaceObject] owner the namespace the list should be associated with
9
+ # @return [CodeObjectList]
4
10
  def initialize(owner = Registry.root)
5
11
  @owner = owner
6
12
  end
7
13
 
14
+ # Adds a new value to the list
15
+ #
16
+ # @param [Base] value a code object to add
17
+ # @return [CodeObjectList] self
8
18
  def push(value)
9
19
  value = Proxy.new(@owner, value) if value.is_a?(String) || value.is_a?(Symbol)
10
20
  if value.is_a?(CodeObjects::Base) || value.is_a?(Proxy)
@@ -17,8 +27,11 @@ module YARD
17
27
  alias_method :<<, :push
18
28
  end
19
29
 
20
- NSEPQ = NSEP = '::'
21
- ISEPQ = ISEP = '#'
30
+
31
+ NSEP = '::'
32
+ NSEPQ = NSEP
33
+ ISEP = '#'
34
+ ISEPQ = ISEP
22
35
  CSEP = '.'
23
36
  CSEPQ = Regexp.quote CSEP
24
37
  CONSTANTMATCH = /[A-Z]\w*/
@@ -42,13 +55,73 @@ module YARD
42
55
 
43
56
  BUILTIN_EXCEPTIONS_HASH = BUILTIN_EXCEPTIONS.inject({}) {|h,n| h.update(n => true) }
44
57
 
58
+ # +Base+ is the superclass of all code objects recognized by YARD. A code
59
+ # object is any entity in the Ruby language (class, method, module). A
60
+ # DSL might subclass +Base+ to create a new custom object representing
61
+ # a new entity type.
62
+ #
63
+ # == Registry Integration
64
+ # Any created object associated with a namespace is immediately registered
65
+ # with the registry. This allows the Registry to act as an identity map
66
+ # to ensure that no object is represented by more than one Ruby object
67
+ # in memory. A unique {#path} is essential for this identity map to work
68
+ # correctly.
69
+ #
70
+ # == Custom Attributes
71
+ # Code objects allow arbitrary custom attributes to be set using the
72
+ # {#[]=} assignment method.
73
+ #
74
+ # == Namespaces
75
+ # There is a special type of object called a "namespace". These are subclasses
76
+ # of the {NamespaceObject} and represent Ruby entities that can have
77
+ # objects defined within them. Classically these are modules and classes,
78
+ # though a DSL might create a custom {NamespaceObject} to describe a
79
+ # specific set of objects.
80
+ #
81
+ # @abstract This class should not be used directly. Instead, create a
82
+ # subclass that implements {#path}, {#sep} or {#type}.
83
+ # @see Registry
84
+ # @see #path
85
+ # @see #[]=
86
+ # @see NamespaceObject
45
87
  class Base
46
- attr_reader :name, :files
47
- attr_accessor :namespace, :source, :signature, :docstring, :dynamic
88
+ # The files the object was defined in. To add a file, use {#add_file}.
89
+ # @return [Array<String>] a list of files
90
+ # @see #add_file
91
+ attr_reader :files
92
+
93
+ # The namespace the object is defined in. If the object is in the
94
+ # top level namespace, this is {Registry#root}
95
+ # @return [NamespaceObject] the namespace object
96
+ attr_accessor :namespace
97
+
98
+ # The source code associated with the object
99
+ # @return [String, nil] source, if present, or nil
100
+ attr_accessor :source
101
+
102
+ # The one line signature representing an object. For a method, this will
103
+ # be of the form "def meth(arguments...)". This is usually the first
104
+ # source line.
105
+ #
106
+ # @return [String] a line of source
107
+ attr_accessor :signature
108
+
109
+ # The documentation string associated with the object
110
+ # @return [Docstring] the documentation string
111
+ attr_accessor :docstring
112
+
113
+ # Marks whether or not the method is conditionally defined at runtime
114
+ # @return [Boolean] true if the method is conditionally defined at runtime
115
+ attr_accessor :dynamic
48
116
 
117
+ # Is the object defined conditionally at runtime?
118
+ # @see #dynamic
49
119
  def dynamic?; @dynamic end
50
120
 
51
121
  class << self
122
+ # Allocates a new code object
123
+ # @return [Base]
124
+ # @see #initialize
52
125
  def new(namespace, name, *args, &block)
53
126
  if name.to_s[0,2] == NSEP
54
127
  name = name.to_s[2..-1]
@@ -79,11 +152,29 @@ module YARD
79
152
  end
80
153
  end
81
154
 
155
+ # Compares the class with subclasses
156
+ #
157
+ # @param [Object] other the other object to compare classes with
158
+ # @return [Boolean] true if other is a subclass of self
82
159
  def ===(other)
83
160
  self >= other.class ? true : false
84
161
  end
85
162
  end
86
163
 
164
+ # Creates a new code object
165
+ #
166
+ # @example Create a method in the root namespace
167
+ # CodeObjects::Base.new(:root, '#method') # => #<yardoc method #method>
168
+ # @example Create class Z inside namespace X::Y
169
+ # CodeObjects::Base.new(P("X::Y"), :Z) # or
170
+ # CodeObjects::Base.new(Registry.root, "X::Y")
171
+ # @param [NamespaceObject] namespace the namespace the object belongs in,
172
+ # {Registry#root} or :root should be provided if it is associated with
173
+ # the top level namespace.
174
+ # @param [Symbol, String] name the name (or complex path) of the object.
175
+ # @yield [self] a block to perform any extra initialization on the object
176
+ # @yieldparam [Base] self the newly initialized code object
177
+ # @return [Base] the newly created object
87
178
  def initialize(namespace, name, *args)
88
179
  if namespace && namespace != :root &&
89
180
  !namespace.is_a?(NamespaceObject) && !namespace.is_a?(Proxy)
@@ -99,12 +190,22 @@ module YARD
99
190
  yield(self) if block_given?
100
191
  end
101
192
 
193
+ # The name of the object
194
+ # @param [Boolean] prefix whether to show a prefix. Implement
195
+ # this in a subclass to define how the prefix is showed.
196
+ # @return [Symbol] if prefix is false, the symbolized name
197
+ # @return [String] if prefix is true, prefix + the name as a String.
198
+ # This must be implemented by the subclass.
199
+ def name(prefix = false)
200
+ prefix ? @name.to_s : @name
201
+ end
202
+
102
203
  # Associates a file with a code object, optionally adding the line where it was defined.
103
- # By convention, '<STDIN>' should be used to associate code that comes form standard input.
204
+ # By convention, '<stdin>' should be used to associate code that comes form standard input.
104
205
  #
105
- # @param [String] file the filename ('<STDIN>' for standard input)
106
- # @param [Fixnum, nil] the line number where the object lies in the file
107
- # @param [Boolean] whether or not the definition has comments associated. This
206
+ # @param [String] file the filename ('<stdin>' for standard input)
207
+ # @param [Fixnum, nil] line the line number where the object lies in the file
208
+ # @param [Boolean] has_comments whether or not the definition has comments associated. This
108
209
  # will allow {#file} to return the definition where the comments were made instead
109
210
  # of any empty definitions that might have been parsed before (module namespaces for instance).
110
211
  def add_file(file, line = nil, has_comments = false)
@@ -134,6 +235,10 @@ module YARD
134
235
  @files.first ? @files.first[1] : nil
135
236
  end
136
237
 
238
+ # Tests if another object is equal to this, including a proxy
239
+ # @param [Base, Proxy] other if other is a {Proxy}, tests if
240
+ # the paths are equal
241
+ # @return [Boolean] whether or not the objects are considered the same
137
242
  def ==(other)
138
243
  if other.is_a?(Proxy)
139
244
  path == other.path
@@ -142,6 +247,10 @@ module YARD
142
247
  end
143
248
  end
144
249
 
250
+ # Accesses a custom attribute on the object
251
+ # @param [#to_s] key the name of the custom attribute
252
+ # @return [Object, nil] the custom attribute or nil if not found.
253
+ # @see #[]=
145
254
  def [](key)
146
255
  if respond_to?(key)
147
256
  send(key)
@@ -150,6 +259,11 @@ module YARD
150
259
  end
151
260
  end
152
261
 
262
+ # Sets a custom attribute on the object
263
+ # @param [#to_s] key the name of the custom attribute
264
+ # @param [Object] value the value to associate
265
+ # @return [nil]
266
+ # @see #[]
153
267
  def []=(key, value)
154
268
  if respond_to?("#{key}=")
155
269
  send("#{key}=", value)
@@ -158,6 +272,12 @@ module YARD
158
272
  end
159
273
  end
160
274
 
275
+ # Checks if the method matches the name of an existing custom
276
+ # attribute.
277
+ #
278
+ # @param [Symbol] meth the name of the method/attribute
279
+ # @raise [NoMethodError] if no method or custom attribute exists by
280
+ # the name +meth+
161
281
  def method_missing(meth, *args, &block)
162
282
  if meth.to_s =~ /=$/
163
283
  self[meth.to_s[0..-2]] = args.first
@@ -168,7 +288,6 @@ module YARD
168
288
  end
169
289
  end
170
290
 
171
- ##
172
291
  # Attaches source code to a code object with an optional file location
173
292
  #
174
293
  # @param [#source, String] statement
@@ -184,7 +303,6 @@ module YARD
184
303
  end
185
304
  end
186
305
 
187
- ##
188
306
  # Attaches a docstring to a code oject by parsing the comments attached to the statement
189
307
  # and filling the {#tags} and {#docstring} methods with the parsed information.
190
308
  #
@@ -195,16 +313,23 @@ module YARD
195
313
  @docstring = Docstring === comments ? comments : Docstring.new(comments, self)
196
314
  end
197
315
 
198
- ##
199
- # Default type is the lowercase class name without the "Object" suffix
200
- #
201
- # Override this method to provide a custom object type
316
+ # Default type is the lowercase class name without the "Object" suffix.
317
+ # Override this method to provide a custom object type
202
318
  #
203
319
  # @return [Symbol] the type of code object this represents
204
320
  def type
205
321
  self.class.name.split(/#{NSEPQ}/).last.gsub(/Object$/, '').downcase.to_sym
206
322
  end
207
323
 
324
+ # Represents the unique path of the object. The default implementation
325
+ # joins the path of {#namespace} with {#name} via the value of {#sep}.
326
+ # Custom code objects should ensure that the path is unique to the code
327
+ # object by either overriding {#sep} or this method.
328
+ #
329
+ # @example The path of an instance method
330
+ # MethodObject.new(P("A::B"), :c).path # => "A::B#c"
331
+ # @return [String] the unique path of the object
332
+ # @see #sep
208
333
  def path
209
334
  if parent && parent != Registry.root
210
335
  [parent.path, name.to_s].join(sep)
@@ -214,10 +339,35 @@ module YARD
214
339
  end
215
340
  alias_method :to_s, :path
216
341
 
342
+ # Renders the object using the {Templates::Engine templating system}.
343
+ #
344
+ # @example Formats a class in plaintext
345
+ # puts P('MyClass').format
346
+ # @example Formats a method in html with rdoc markup
347
+ # puts P('MyClass#meth').format(:format => :html, :markup => :rdoc)
348
+ # @param [Hash] options a set of options to pass to the template
349
+ # @option options [Symbol] :format (:text) :html, :text or another output format
350
+ # @option options [Symbol] :template (:default) a specific template to use
351
+ # @option options [Symbol] :markup (nil) the markup type (:rdoc, :markdown, :textile)
352
+ # @option options [Serializers::Base] :serializer (nil) see Serializers
353
+ # @return [String] the rendered template
354
+ # @see Templates::Engine#render
355
+ def format(options = {})
356
+ options.merge!(:object => self)
357
+ Templates::Engine.render(options)
358
+ end
359
+
360
+ # Inspects the object, returning the type and path
361
+ # @return [String] a string describing the object
217
362
  def inspect
218
363
  "#<yardoc #{type} #{path}>"
219
364
  end
220
365
 
366
+ # Sets the namespace the object is defined in.
367
+ #
368
+ # @param [NamespaceObject, :root, nil] obj the new namespace (:root
369
+ # for {Registry#root}). If obj is nil, the object is unregistered
370
+ # from the Registry.
221
371
  def namespace=(obj)
222
372
  if @namespace
223
373
  @namespace.children.delete(self)
@@ -235,15 +385,33 @@ module YARD
235
385
  alias_method :parent, :namespace
236
386
  alias_method :parent=, :namespace=
237
387
 
388
+ # Gets a tag from the {#docstring}
389
+ # @see Docstring#tag
238
390
  def tag(name); @docstring.tag(name) end
391
+
392
+ # Gets a list of tags from the {#docstring}
393
+ # @see Docstring#tags
239
394
  def tags(name = nil); @docstring.tags(name) end
395
+
396
+ # Tests if the {#docstring} has a tag
397
+ # @see Docstring#has_tag?
240
398
  def has_tag?(name); @docstring.has_tag?(name) end
241
399
 
242
400
  protected
243
401
 
402
+ # Override this method with a custom component separator. For instance,
403
+ # {MethodObject} implements sep as '#' or '.' (depending on if the
404
+ # method is instance or class respectively). {#path} depends on this
405
+ # value to generate the full path in the form: namespace.path + sep + name
406
+ #
407
+ # @return [String] the component that separates the namespace path
408
+ # and the name (default is {NSEP})
244
409
  def sep; NSEP end
245
410
 
246
411
  # Formats source code by removing leading indentation
412
+ #
413
+ # @param [String] source the source code to format
414
+ # @return [String] formatted source
247
415
  def format_source(source)
248
416
  source.chomp!
249
417
  indent = source.split(/\r?\n/).last[/^([ \t]*)/, 1].length
@@ -1,7 +1,12 @@
1
1
  module YARD::CodeObjects
2
2
  class ClassObject < NamespaceObject
3
+ # The {ClassObject} that this class object inherits from in Ruby source.
4
+ # @return [ClassObject] a class object that is the superclass of this one
3
5
  attr_accessor :superclass
4
6
 
7
+ # Creates a new class object in +namespace+ with +name+
8
+ #
9
+ # @see Base.new
5
10
  def initialize(namespace, name, *args, &block)
6
11
  super
7
12
 
@@ -12,14 +17,23 @@ module YARD::CodeObjects
12
17
  end
13
18
  end
14
19
 
20
+ # Whether or not the class is a Ruby Exception
21
+ #
22
+ # @return [Boolean] whether the object represents a Ruby exception
15
23
  def is_exception?
16
24
  inheritance_tree.reverse.any? {|o| BUILTIN_EXCEPTIONS_HASH.has_key? o.path }
17
25
  end
18
26
 
27
+ # Returns the inheritance tree of the object including self.
28
+ #
29
+ # @param [Boolean] include_mods whether or not to include mixins in the
30
+ # inheritance tree.
31
+ # @return [Array<NamespaceObject>] the list of code objects that make up
32
+ # the inheritance tree.
19
33
  def inheritance_tree(include_mods = false)
20
34
  list = (include_mods ? mixins(:instance) : [])
21
35
  if superclass.is_a?(Proxy) || superclass.respond_to?(:inheritance_tree)
22
- list << superclass unless superclass == P(:Object)
36
+ list += [superclass] unless superclass == P(:Object)
23
37
  end
24
38
  [self] + list.map do |m|
25
39
  next m unless m.respond_to?(:inheritance_tree)
@@ -27,11 +41,23 @@ module YARD::CodeObjects
27
41
  end.flatten
28
42
  end
29
43
 
44
+ # Returns the list of methods matching the options hash. Returns
45
+ # all methods if hash is empty.
46
+ #
47
+ # @param [Hash] opts the options hash to match
48
+ # @option opts [Boolean] :inherited (true) whether inherited methods should be
49
+ # included in the list
50
+ # @option opts [Boolean] :included (true) whether mixed in methods should be
51
+ # included in the list
52
+ # @return [Array<MethodObject>] the list of methods that matched
30
53
  def meths(opts = {})
31
54
  opts = SymbolHash[:inherited => true].update(opts)
32
55
  super(opts) + (opts[:inherited] ? inherited_meths(opts) : [])
33
56
  end
34
57
 
58
+ # Returns only the methods that were inherited.
59
+ #
60
+ # @return [Array<MethodObject>] the list of inherited method objects
35
61
  def inherited_meths(opts = {})
36
62
  inheritance_tree[1..-1].inject([]) do |list, superclass|
37
63
  if superclass.is_a?(Proxy)
@@ -45,11 +71,22 @@ module YARD::CodeObjects
45
71
  end
46
72
  end
47
73
 
74
+ # Returns the list of constants matching the options hash.
75
+ #
76
+ # @param [Hash] opts the options hash to match
77
+ # @option opts [Boolean] :inherited (true) whether inherited constant should be
78
+ # included in the list
79
+ # @option opts [Boolean] :included (true) whether mixed in constant should be
80
+ # included in the list
81
+ # @return [Array<ConstantObject>] the list of constant that matched
48
82
  def constants(opts = {})
49
83
  opts = SymbolHash[:inherited => true].update(opts)
50
84
  super(opts) + (opts[:inherited] ? inherited_constants : [])
51
85
  end
52
86
 
87
+ # Returns only the constants that were inherited.
88
+ #
89
+ # @return [Array<ConstantObject>] the list of inherited constant objects
53
90
  def inherited_constants
54
91
  inheritance_tree[1..-1].inject([]) do |list, superclass|
55
92
  if superclass.is_a?(Proxy)
@@ -62,10 +99,10 @@ module YARD::CodeObjects
62
99
  end
63
100
  end
64
101
 
65
- ##
66
102
  # Sets the superclass of the object
67
103
  #
68
104
  # @param [Base, Proxy, String, Symbol, nil] object the superclass value
105
+ # @return [nil]
69
106
  def superclass=(object)
70
107
  case object
71
108
  when Base, Proxy, NilClass
@@ -1,4 +1,8 @@
1
1
  module YARD::CodeObjects
2
+ # Represents a class variable inside a namespace. The path is expressed
3
+ # in the form "A::B::@@classvariable"
2
4
  class ClassVariableObject < Base
5
+ # @return [String] the class variable's value
6
+ attr_accessor :value
3
7
  end
4
8
  end
@@ -1,5 +1,13 @@
1
1
  module YARD::CodeObjects
2
+ # A +ConstantObject+ represents a Ruby constant (not a module or class).
3
+ # To access the constant's (source code) value, use {#value}.
2
4
  class ConstantObject < Base
5
+ # The source code representing the constant's value
6
+ # @return [String] the value the constant is set to
3
7
  attr_accessor :value
8
+
9
+ def value=(value)
10
+ @value = format_source(value)
11
+ end
4
12
  end
5
13
  end
@@ -1,9 +1,23 @@
1
1
  module YARD::CodeObjects
2
+ # Represents an instance method of a module that was mixed into the class
3
+ # scope of another namespace.
4
+ #
5
+ # @see MethodObject
2
6
  class ExtendedMethodObject
3
7
  instance_methods.each {|m| undef_method(m) unless m =~ /^__/ || m.to_sym == :object_id }
4
8
 
9
+ # @return [Symbol] always +:class+
5
10
  def scope; :class end
11
+
12
+ # Sets up a delegate for {MethodObject} obj.
13
+ #
14
+ # @param [MethodObject] obj the instance method to treat as a mixed in
15
+ # class method on another namespace.
6
16
  def initialize(obj) @del = obj end
17
+
18
+ # Sends all methods to the {MethodObject} assigned in {#initialize}
19
+ # @see #initialize
20
+ # @see MethodObject
7
21
  def method_missing(sym, *args, &block) @del.__send__(sym, *args, &block) end
8
22
  end
9
23
  end