Class: RDoc::Example
| Relationships & Source Files | |
| Namespace Children | |
|
Modules:
| |
|
Classes:
| |
| Inherits: | Object |
| Defined in: | doc/rdoc/example.rb |
Overview
Example provides example Ruby code objects for demonstrating RDoc’s documentation capabilities.
This class is used by:
-
bin/console for interactive exploration of
RDocobjects -
Testing cross-reference link generation
-
Demonstrating Ruby-specific directives like :call-seq:, :args:, :yields:
For comprehensive RDoc markup documentation, see doc/markup_reference/rdoc.rdoc.
Constant Summary
-
EXAMPLE_CONSTANT =
# File 'doc/rdoc/example.rb', line 43
Exampleconstant.''
Class Method Summary
-
.singleton_method_example(foo, bar)
Examplesingleton method.
Instance Attribute Summary
-
#aliased_attribute
readonly
Aliasfor #example_attribute. -
#example_attribute
(also: #aliased_attribute)
rw
Exampleattribute.
Instance Method Summary
- #aliased_method(foo, bar)
-
#args_example(foo, bar)
The
:args:directive overrides the actual arguments found in the Ruby code. -
#call_seq_example(foo, bar)
The
:call-seq:directive overrides the actual calling sequence found in the Ruby code. -
#derived_docs_example(foo, bar) {|'baz'| ... }
This method is documented only by RDoc’s derived documentation, except for these comments.
-
#instance_method_example(foo, bar) {|'baz'| ... }
(also: #aliased_method)
Exampleinstance method. -
#yields_example(foo, bar) {|'baz'| ... }
The
:yields:directive overrides the actual yield found in the Ruby code.
Class Method Details
.singleton_method_example(foo, bar)
Example singleton method.
# File 'doc/rdoc/example.rb', line 25
def self.singleton_method_example(foo, ); end
Instance Attribute Details
#aliased_attribute (readonly)
Alias for #example_attribute.
# File 'doc/rdoc/example.rb', line 40
alias aliased_attribute example_attribute
#example_attribute (rw) Also known as: #aliased_attribute
Example attribute.
# File 'doc/rdoc/example.rb', line 38
attr_accessor :example_attribute
Instance Method Details
#aliased_method(foo, bar)
[ GitHub ]# File 'doc/rdoc/example.rb', line 35
alias aliased_method instance_method_example
#args_example(foo, bar)
The :args: directive overrides the actual arguments found in the Ruby code.
The actual signature is args_example(foo, bar), but the directive makes it appear as args_example(baz).
# File 'doc/rdoc/example.rb', line 76
def args_example(foo, ) # :args: baz nil end
#call_seq_example(foo, bar)
#be(anything) ⇒ bar
#anything(more) ⇒ baz, bat
bar
#anything(more) ⇒ baz, bat
The :call-seq: directive overrides the actual calling sequence found in the Ruby code.
-
It can specify anything at all.
-
It can have multiple calling sequences.
Note that the “arrow” is two characters, hyphen and right angle-bracket, which is made into a single character in the HTML.
Here is the :call-seq: directive given for this method:
:call-seq:
call_seq_example(foo, )
Can be anything ->
Also anything more -> baz or bat
# File 'doc/rdoc/example.rb', line 66
def call_seq_example nil end
#derived_docs_example(foo, bar) {|'baz'| ... }
This method is documented only by RDoc’s derived documentation, except for these comments.
RDoc automatically extracts:
-
Method name
-
Arguments
-
Yielded values
# File 'doc/rdoc/example.rb', line 98
def derived_docs_example(foo, ) yield 'baz' end
#instance_method_example(foo, bar) {|'baz'| ... } Also known as: #aliased_method
Example instance method.
This method demonstrates how RDoc documents instance methods, including arguments and yield parameters.
# File 'doc/rdoc/example.rb', line 31
def instance_method_example(foo, ) yield 'baz' end
#yields_example(foo, bar) {|'baz'| ... }
The :yields: directive overrides the actual yield found in the Ruby code.
The actual yield is ‘baz’, but the directive makes it appear as ‘bat’.
# File 'doc/rdoc/example.rb', line 86
def yields_example(foo, ) # :yields: 'bat' yield 'baz' end