yard 0.9.29 → 0.9.30
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.
- checksums.yaml +4 -4
- data/docs/CodeObjects.md +115 -0
- data/docs/GettingStarted.md +679 -0
- data/docs/Handlers.md +152 -0
- data/docs/Overview.md +61 -0
- data/docs/Parser.md +191 -0
- data/docs/Tags.md +283 -0
- data/docs/TagsArch.md +123 -0
- data/docs/Templates.md +496 -0
- data/docs/WhatsNew.md +1245 -0
- data/docs/images/code-objects-class-diagram.png +0 -0
- data/docs/images/handlers-class-diagram.png +0 -0
- data/docs/images/overview-class-diagram.png +0 -0
- data/docs/images/parser-class-diagram.png +0 -0
- data/docs/images/tags-class-diagram.png +0 -0
- data/docs/templates/default/fulldoc/html/full_list_tag.erb +9 -0
- data/docs/templates/default/fulldoc/html/setup.rb +6 -0
- data/docs/templates/default/layout/html/setup.rb +9 -0
- data/docs/templates/default/layout/html/tag_list.erb +11 -0
- data/docs/templates/default/yard_tags/html/list.erb +18 -0
- data/docs/templates/default/yard_tags/html/setup.rb +26 -0
- data/docs/templates/plugin.rb +70 -0
- data/lib/yard/version.rb +1 -1
- data/po/ja.po +31108 -0
- data/templates/default/class/dot/setup.rb +7 -0
- data/templates/default/class/dot/superklass.erb +3 -0
- data/templates/default/class/html/constructor_details.erb +8 -0
- data/templates/default/class/html/setup.rb +2 -0
- data/templates/default/class/html/subclasses.erb +4 -0
- data/templates/default/class/setup.rb +36 -0
- data/templates/default/class/text/setup.rb +12 -0
- data/templates/default/class/text/subclasses.erb +5 -0
- data/templates/default/constant/text/header.erb +11 -0
- data/templates/default/constant/text/setup.rb +4 -0
- data/templates/default/docstring/html/abstract.erb +4 -0
- data/templates/default/docstring/html/deprecated.erb +1 -0
- data/templates/default/docstring/html/index.erb +5 -0
- data/templates/default/docstring/html/note.erb +6 -0
- data/templates/default/docstring/html/private.erb +4 -0
- data/templates/default/docstring/html/returns_void.erb +1 -0
- data/templates/default/docstring/html/text.erb +1 -0
- data/templates/default/docstring/html/todo.erb +6 -0
- data/templates/default/docstring/setup.rb +52 -0
- data/templates/default/docstring/text/abstract.erb +2 -0
- data/templates/default/docstring/text/deprecated.erb +2 -0
- data/templates/default/docstring/text/index.erb +2 -0
- data/templates/default/docstring/text/note.erb +4 -0
- data/templates/default/docstring/text/private.erb +2 -0
- data/templates/default/docstring/text/returns_void.erb +1 -0
- data/templates/default/docstring/text/text.erb +1 -0
- data/templates/default/docstring/text/todo.erb +4 -0
- data/templates/default/fulldoc/html/css/common.css +1 -0
- data/templates/default/fulldoc/html/css/full_list.css +58 -0
- data/templates/default/fulldoc/html/css/style.css +497 -0
- data/templates/default/fulldoc/html/frames.erb +17 -0
- data/templates/default/fulldoc/html/full_list.erb +37 -0
- data/templates/default/fulldoc/html/full_list_class.erb +2 -0
- data/templates/default/fulldoc/html/full_list_file.erb +7 -0
- data/templates/default/fulldoc/html/full_list_method.erb +10 -0
- data/templates/default/fulldoc/html/js/app.js +314 -0
- data/templates/default/fulldoc/html/js/full_list.js +216 -0
- data/templates/default/fulldoc/html/js/jquery.js +4 -0
- data/templates/default/fulldoc/html/setup.rb +241 -0
- data/templates/default/layout/dot/header.erb +6 -0
- data/templates/default/layout/dot/setup.rb +15 -0
- data/templates/default/layout/html/breadcrumb.erb +11 -0
- data/templates/default/layout/html/files.erb +11 -0
- data/templates/default/layout/html/footer.erb +5 -0
- data/templates/default/layout/html/headers.erb +15 -0
- data/templates/default/layout/html/index.erb +2 -0
- data/templates/default/layout/html/layout.erb +24 -0
- data/templates/default/layout/html/listing.erb +4 -0
- data/templates/default/layout/html/objects.erb +32 -0
- data/templates/default/layout/html/script_setup.erb +4 -0
- data/templates/default/layout/html/search.erb +13 -0
- data/templates/default/layout/html/setup.rb +89 -0
- data/templates/default/method/html/header.erb +17 -0
- data/templates/default/method/setup.rb +4 -0
- data/templates/default/method/text/header.erb +1 -0
- data/templates/default/method_details/html/header.erb +3 -0
- data/templates/default/method_details/html/method_signature.erb +25 -0
- data/templates/default/method_details/html/source.erb +10 -0
- data/templates/default/method_details/setup.rb +11 -0
- data/templates/default/method_details/text/header.erb +10 -0
- data/templates/default/method_details/text/method_signature.erb +12 -0
- data/templates/default/method_details/text/setup.rb +11 -0
- data/templates/default/module/dot/child.erb +1 -0
- data/templates/default/module/dot/dependencies.erb +3 -0
- data/templates/default/module/dot/header.erb +6 -0
- data/templates/default/module/dot/info.erb +14 -0
- data/templates/default/module/dot/setup.rb +15 -0
- data/templates/default/module/html/attribute_details.erb +10 -0
- data/templates/default/module/html/attribute_summary.erb +8 -0
- data/templates/default/module/html/box_info.erb +43 -0
- data/templates/default/module/html/children.erb +8 -0
- data/templates/default/module/html/constant_summary.erb +17 -0
- data/templates/default/module/html/defines.erb +3 -0
- data/templates/default/module/html/header.erb +5 -0
- data/templates/default/module/html/inherited_attributes.erb +14 -0
- data/templates/default/module/html/inherited_constants.erb +8 -0
- data/templates/default/module/html/inherited_methods.erb +19 -0
- data/templates/default/module/html/item_summary.erb +40 -0
- data/templates/default/module/html/method_details_list.erb +9 -0
- data/templates/default/module/html/method_summary.erb +14 -0
- data/templates/default/module/html/methodmissing.erb +12 -0
- data/templates/default/module/html/pre_docstring.erb +1 -0
- data/templates/default/module/setup.rb +167 -0
- data/templates/default/module/text/children.erb +10 -0
- data/templates/default/module/text/class_meths_list.erb +8 -0
- data/templates/default/module/text/extends.erb +8 -0
- data/templates/default/module/text/header.erb +7 -0
- data/templates/default/module/text/includes.erb +8 -0
- data/templates/default/module/text/instance_meths_list.erb +8 -0
- data/templates/default/module/text/setup.rb +13 -0
- data/templates/default/onefile/html/files.erb +5 -0
- data/templates/default/onefile/html/headers.erb +6 -0
- data/templates/default/onefile/html/layout.erb +17 -0
- data/templates/default/onefile/html/readme.erb +3 -0
- data/templates/default/onefile/html/setup.rb +62 -0
- data/templates/default/root/dot/child.erb +3 -0
- data/templates/default/root/dot/setup.rb +6 -0
- data/templates/default/root/html/setup.rb +2 -0
- data/templates/default/tags/html/example.erb +11 -0
- data/templates/default/tags/html/index.erb +3 -0
- data/templates/default/tags/html/option.erb +24 -0
- data/templates/default/tags/html/overload.erb +14 -0
- data/templates/default/tags/html/see.erb +8 -0
- data/templates/default/tags/html/tag.erb +20 -0
- data/templates/default/tags/setup.rb +57 -0
- data/templates/default/tags/text/example.erb +12 -0
- data/templates/default/tags/text/index.erb +1 -0
- data/templates/default/tags/text/option.erb +20 -0
- data/templates/default/tags/text/overload.erb +19 -0
- data/templates/default/tags/text/see.erb +11 -0
- data/templates/default/tags/text/tag.erb +13 -0
- data/templates/guide/class/html/setup.rb +2 -0
- data/templates/guide/docstring/html/setup.rb +2 -0
- data/templates/guide/fulldoc/html/css/style.css +108 -0
- data/templates/guide/fulldoc/html/js/app.js +33 -0
- data/templates/guide/fulldoc/html/setup.rb +74 -0
- data/templates/guide/layout/html/layout.erb +81 -0
- data/templates/guide/layout/html/setup.rb +25 -0
- data/templates/guide/method/html/header.erb +18 -0
- data/templates/guide/method/html/setup.rb +22 -0
- data/templates/guide/module/html/header.erb +7 -0
- data/templates/guide/module/html/method_list.erb +5 -0
- data/templates/guide/module/html/setup.rb +27 -0
- data/templates/guide/onefile/html/files.erb +4 -0
- data/templates/guide/onefile/html/setup.rb +6 -0
- data/templates/guide/onefile/html/toc.erb +3 -0
- data/templates/guide/tags/html/setup.rb +9 -0
- metadata +151 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 021c7da620d7d0f9e325578d006aaad1a1875de4e8576b40c5f31743d3eb6acf
|
4
|
+
data.tar.gz: efc16a043c80228b5930fa4926ff169b2e37851b93b978664fc33b3badb9b3ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2df308de968686b9330b893962e34e06cb4fd8f5171c6bd43a21c2ede8691a432df56d1a8ab5f15d600a624ec7b8807542447ebb79952caceb5d24936188a84f
|
7
|
+
data.tar.gz: 8106bcbef9ddc3623845825101f58f7014fa13134e78b6382e5e439664031216083ce0a1346d29c763e966eb588d3251073f7e137e81c984c1dc1730d243e147
|
data/docs/CodeObjects.md
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
# @title CodeObjects Architecture
|
2
|
+
|
3
|
+
# CodeObjects Architecture
|
4
|
+
|
5
|
+
Code objects are Ruby objects that describe the code being documented. For instance,
|
6
|
+
all classes, modules, methods, etc. are all extracted from the Ruby source as code
|
7
|
+
objects. All of these code objects extend from the {YARD::CodeObjects::Base} class, which
|
8
|
+
provides basic attributes like source location, source code, name and path.
|
9
|
+
|
10
|
+
## CodeObjects Organization
|
11
|
+
|
12
|
+
Code objects are divided into two basic types. {YARD::CodeObjects::NamespaceObject NamespaceObjects}
|
13
|
+
and non-namespace objects. A namespace object refers to any object in Ruby that can have
|
14
|
+
other objects defined inside of it. In the context of Ruby, this specifically means
|
15
|
+
modules and classes (both of which are subclasses of `NamespaceObject`). These objects
|
16
|
+
act like tree structures, maintaining a list of all of their direct children. All non
|
17
|
+
namespace objects are simply subclasses of the Base class. The {YARD::CodeObjects::RootObject RootObject}
|
18
|
+
is a special kind of `NamespaceObject` which refers to the top level namespace in Ruby.
|
19
|
+
Methods that accept a namespace object as a parameter should also accept the symbol
|
20
|
+
`:root` as a shortcut for the root object.
|
21
|
+
|
22
|
+
The following is an overview of the classes within the `CodeObjects` namespace:
|
23
|
+
|
24
|
+
![CodeObjects Class Diagram](images/code-objects-class-diagram.png)
|
25
|
+
|
26
|
+
## Unique Path Representation
|
27
|
+
|
28
|
+
All CodeObjects are uniquely defined by their implementation of {YARD::CodeObjects::Base#path}.
|
29
|
+
This path is used to locate or store a code object in the {YARD::Registry}. It is therefore
|
30
|
+
essential that any Base subclass return a unique String value for #path so that the
|
31
|
+
object may co-exist with other objects in the Registry.
|
32
|
+
|
33
|
+
In practice, a path is simply the conventional Ruby representation of a class,
|
34
|
+
module, constant, class variable or method. For example, the following objects
|
35
|
+
would have the following respective paths:
|
36
|
+
|
37
|
+
* Class `Klass` inside module `Mod`: `Mod::Klass`
|
38
|
+
* Instance method `bar` inside class `Foo`: `Foo#bar`
|
39
|
+
* Class method `bar` inside class `Foo`: `Foo.bar`
|
40
|
+
* Constant `VERSION` inside class `YARD`: `YARD::VERSION`
|
41
|
+
* Class variable `@@abc` inside class `A`: `A::@@abc`
|
42
|
+
|
43
|
+
## Registry
|
44
|
+
|
45
|
+
CodeObjects classes are coupled with the {YARD::Registry} class which keeps track of
|
46
|
+
all instantiated code objects. This is an explicit design choice to allow objects
|
47
|
+
to be fetched, cached, imported and exported from a centralized location. As mentioned
|
48
|
+
above, this coupling is a result of the fact that each object is uniquely identified by
|
49
|
+
its path, which is used to implement lookups. You can read more about the registry
|
50
|
+
in the {YARD::Registry} class.
|
51
|
+
|
52
|
+
## Identity Map
|
53
|
+
|
54
|
+
Code objects are instantiated using an identity-map like implementation that guarantees
|
55
|
+
only one unique Ruby object exists for an object described by a specific path. This
|
56
|
+
allows developers to create a code object without checking if it already exists in
|
57
|
+
the {YARD::Registry}. The following example will only create one object:
|
58
|
+
|
59
|
+
id = ClassObject.new(:root, "MyClass").object_id #=> 13352
|
60
|
+
ClassObject.new(:root, "MyClass").object_id #=> 13352
|
61
|
+
|
62
|
+
## Proxy Objects
|
63
|
+
|
64
|
+
In addition to providing access to existing objects, a {YARD::CodeObjects::Proxy}
|
65
|
+
class exists which can represent an object at a path that may or may not have been
|
66
|
+
created. This is necessary to represent a reference to an object in code that is
|
67
|
+
never defined in the same body of source code, or perhaps defined later. If any
|
68
|
+
attributes of a proxy are accessed, it will immediately be resolved to the object
|
69
|
+
at its declared path. In the case where such an object exists, it will act as
|
70
|
+
a delegate to the object. However, if the object does not exist, a warning will
|
71
|
+
be raised. Whenever arbitrary code objects are used, care should be taken in
|
72
|
+
order to make sure attributes are not accessed on unresolvable proxies. An
|
73
|
+
unresolvable proxy will return a class name of `Proxy` and #type of `:proxy`,
|
74
|
+
for example:
|
75
|
+
|
76
|
+
P(:InvalidObject).type == :proxy #=> true
|
77
|
+
P(:InvalidObject).is_a?(Proxy) #=> true
|
78
|
+
|
79
|
+
## Adding Data to Code Objects
|
80
|
+
|
81
|
+
Code objects act as hash-like structures that allow any arbitrary value to be set.
|
82
|
+
This allows easy extending of existing objects without creating custom subclasses.
|
83
|
+
For instance, to add a timestamp to a method object (when it was modified, maybe),
|
84
|
+
it is possible to simply do:
|
85
|
+
|
86
|
+
object = MethodObject.new(:root, "my_method")
|
87
|
+
object[:modified_at] = Time.now
|
88
|
+
|
89
|
+
This value can now be retrieved on this object both by the hash `[]` syntax as
|
90
|
+
well as like any other method:
|
91
|
+
|
92
|
+
object.modified_at #=> 2009-06-03 20:08:46 -0400
|
93
|
+
|
94
|
+
## Creating a Custom CodeObject
|
95
|
+
|
96
|
+
It should first be mentioned that creating a custom code object should not be
|
97
|
+
necessary in most cases, except when functionality that cannot be represented
|
98
|
+
by classical Ruby objects is added. A good example *might* be a test class,
|
99
|
+
which although is technically a Ruby class, has a significantly different purpose
|
100
|
+
in documentation and needs a different set of metadata, as well as its own
|
101
|
+
representation in documentation.
|
102
|
+
|
103
|
+
The {YARD::CodeObjects::Base#path} implementation is the most important part of the
|
104
|
+
code object architecture. The first thing any custom code object must guarantee is
|
105
|
+
that its path value is unique among all other objects. The recommended way to do this
|
106
|
+
with custom objects is to add a descriptive prefix to the path. For example, the
|
107
|
+
following is an implementation of the path for a hypothetical `FooObject`:
|
108
|
+
|
109
|
+
def path
|
110
|
+
"__FooPrefix" + sep + super
|
111
|
+
end
|
112
|
+
|
113
|
+
Note that if our FooObject is a `NamespaceObject`, meaning if it can have child
|
114
|
+
FooObjects defined inside of it, you may need to verify that the prefix is only
|
115
|
+
applied once.
|