-
Notifications
You must be signed in to change notification settings - Fork 393
Expand file tree
/
Copy pathYard.rb
More file actions
354 lines (325 loc) · 8.62 KB
/
Copy pathYard.rb
File metadata and controls
354 lines (325 loc) · 8.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
cheatsheet do
title 'Yard'
docset_file_name 'Yard'
keyword 'Yard'
source_url 'http://cheat.kapeli.com'
category do
id 'Templates'
entry do
command 'modules'
notes <<-'MD'
```ruby
# Namespace for classes and modules that handle serving documentation over HTTP
# @since 0.6.0
```
MD
end
entry do
command 'classes'
notes <<-'MD'
```ruby
# Abstract base class for CLI utilities. Provides some helper methods for
# the option parser
#
# @author Full Name
# @abstract
# @since 0.6.0
# @attr [Types] attribute_name a full description of the attribute
# @attr_reader [Types] name description of a readonly attribute
# @attr_writer [Types] name description of writeonly attribute
# @deprecated Describe the reason or provide alt. references here
```
MD
end
entry do
command 'methods'
notes <<-'MD'
```ruby
# An alias to {Parser::SourceParser}'s parsing method
#
# @author Donovan Bray
#
# @see http://example.com Description of URL
# @see SomeOtherClass#method
#
# @deprecated Use {#my_new_method} instead of this method because
# it uses a library that is no longer supported in Ruby 1.9.
# The new method accepts the same parameters.
#
# @abstract
# @private
#
# @param [Hash] opts the options to create a message with.
# @option opts [String] :subject The subject
# @option opts [String] :from ('nobody') From address
# @option opts [String] :to Recipient email
# @option opts [String] :body ('') The email's body
#
# @param (see User#initialize)
# @param [OptionParser] opts the option parser object
# @param [Array<String>] args the arguments passed from input. This
# array will be modified.
# @param [Array<String, Symbol>] list the list of strings and symbols.
#
# The options parsed out of the commandline.
# Default options are:
# :format => :dot
#
# @example Reverse a string
# "mystring.reverse" #=> "gnirtsym"
#
# @example Parse a glob of files
# YARD.parse('lib/**/*.rb')
#
# @raise [ExceptionClass] description
#
# @return [optional, types, ...] description
# @return [true] always returns true
# @return [void]
# @return [String, nil] the contents of our object or nil
# if the object has not been filled with data.
#
# We don't care about the "type" here:
# @return the object
#
# @return [String, #read] a string or object that responds to #read
# @return description here with no types
```
MD
end
entry do
command 'anywhere'
notes <<-'MD'
```ruby
# @todo Add support for Jabberwocky service
# There is an open source Jabberwocky library available
# at http://somesite.com that can be integrated easily
# into the project.
```
MD
end
entry do
command 'blocks'
notes <<-'MD'
```ruby
# for block {|a, b, c| ... }
# @yield [a, b, c] Description of block
#
# @yieldparam [optional, types, ...] argname description
# @yieldreturn [optional, types, ...] description
```
MD
end
end
category do
id 'Tags'
entry do
command '@abstract'
notes <<-'MD'
```ruby
# @abstract Subclass and override {#run} to implement
# a custom Threadable class.
class Runnable
def run; raise NotImplementedError end
end
```
MD
end
entry do
command '@api'
notes <<-'MD'
```ruby
class Post
# @api private
def reset_table!; table.flush end
end
```
MD
end
entry do
command '@author'
notes <<-'MD'
```ruby
# @author Foo Bar <foo@bar.com>
class MyClass; end
```
MD
end
entry do
command '@deprecated'
notes <<-'MD'
```ruby
# @deprecated Use {#bar} instead.
def foo; end
class Thread
# @deprecated Exiting a thread in this way is not reliable and
# can cause a program crash.
def kill; end
end
```
MD
end
entry do
command '@example'
notes <<-'MD'
```ruby
# @example Reverse a String
# "mystring".reverse #=> "gnirtsym"
def reverse; end
```
MD
end
entry do
command '@note'
notes <<-'MD'
```ruby
# @note This method should only be used in outer space.
def eject; end
```
MD
end
entry do
command '@option'
notes <<-'MD'
```ruby
# @param [Hash] opts the options to create a message with.
# @option opts [String] :subject The subject
# @option opts [String] :from ('nobody') From address
# @option opts [String] :to Recipient email
# @option opts [String] :body ('') The email's body
def send_email(opts = {}) end
```
MD
end
entry do
command '@overload'
notes <<-'MD'
```ruby
# @overload set(key, value)
# Sets a value on key
# @param key [Symbol] describe key param
# @param value [Object] describe value param
# @overload set(value)
# Sets a value on the default key +:foo+
# @param value [Object] describe value param
def set(*args) end
```
MD
end
entry do
command '@param'
notes <<-'MD'
```ruby
# @param url [String] the URL of the page to download
# @param directory [String] the name of the directory to save to
def load_page(url, directory: 'pages') end
```
MD
end
entry do
command '@private'
notes <<-'MD'
```ruby
# @private
class InteralImplementation; end
```
MD
end
entry do
command '@raise'
notes <<-'MD'
```ruby
# @raise [AccountBalanceError] if the account does not have
# sufficient funds to perform the transaction
def withdraw(amount) end
```
MD
end
entry do
command '@return'
notes <<-'MD'
```ruby
# @return [Fixnum] the size of the file
def size; @file.size end
# @return [String] if a single object was returned
# from the database.
# @return [Array<String>] if multiple objects were
# returned.
def find(query) end
```
MD
end
entry do
command '@see'
notes <<-'MD'
```ruby
# Synchronizes system time using NTP.
# @see http://ntp.org/documentation.html NTP Documentation
# @see NTPHelperMethods
class NTPUpdater; end
```
MD
end
entry do
command '@since'
notes <<-'MD'
```ruby
# @since 1.2.4
def clear_routes; end
```
MD
end
entry do
command '@todo'
notes <<-'MD'
```ruby
# @todo Add support for Jabberwocky service.
# There is an open source Jabberwocky library available
# at http://jbrwcky.org that can be easily integrated.
class Wonderlander; end
```
MD
end
entry do
command '@version'
notes <<-'MD'
```ruby
# The public REST API for http://jbrwcky.org
# @version 2.0
class JabberwockyAPI; end
```
MD
end
entry do
command '@yield'
notes <<-'MD'
```ruby
# For a block {|a,b,c| ... }
# @yield [a, b, c] Gives 3 random numbers to the block
def provide3values(&block) yield(42, 42, 42) end
```
MD
end
entry do
command '@yieldparam'
notes <<-'MD'
```ruby
# @yieldparam [String] name the name that is yielded
def with_name(name) yield(name) end
```
MD
end
entry do
command '@yieldreturn'
notes <<-'MD'
```ruby
# @yieldreturn [Fixnum] the number to add 5 to.
def add5_block(&block) 5 + yield end
```
MD
end
end
notes <<-'END'
* Based on the [Yard Cheatsheet](https://gist.github.com/chetan/1827484) and [Tag Overview](http://www.rubydoc.info/gems/yard/file/docs/Tags.md).
END
end