Class: SleepingKingStudios::Docs::Data::MethodObject
- Parent Namespace
- SleepingKingStudios::Docs::Data
- Inherited Classes
- SleepingKingStudios::Docs::Data::Base
>
Object
- Defined In
- lib/sleeping_king_studios/docs/data/method_object.rb
Table Of Contents
Overview
Object representing a Ruby method.
Each method has a name and a signature, and can define the following
elements:
- Parameters.
- A return type.
- Raised exceptions.
- A yielded block.
In addition, a method may have a short description, a full description, and
metadata.
Back To Top
Constructor
#initialize(native:) => Base
- Inherited From
- SleepingKingStudios::Docs::Data::Base
Parameters
- native (YARD::Tags::Tag) — the YARD object representing the
documented object.
Returns
- (Base) — a new instance of Base
Back To Top
Instance Methods
#alias? => true, false
Returns
- (true, false) — true if the method object is an alias of another
method; otherwise false.
#aliases => Array<String>
Returns
- (Array<String>) — the names of the method aliases, if any.
#as_json => Hash{String => Object}
Generates a JSON-compatible representation of the method.
Returns a Hash with the following keys:
- ‘name’: The full, qualified name of the method.
- ‘slug’: The name of the method in url-safe format.
- ‘signature’: A String representation of the method and its parameters.
- ‘short_description’: A short description of the method.
Additionally, the returned Hash will conditionally include the following
keys, if the method defines at least one of the corresponding code
objects.
- ‘description’: The full description of the method, minus the first
clause.
- ‘metadata’: Additional metadata tags from the documentation.
- ‘params’: The method’s parameters, as documented.
- ‘options’: The method’s option parameters, if any.
- ‘raises’: The exceptions raised by the method.
- ‘returns’: The method’s return types and description.
- ‘yields’: The block yielded by the method.
- ‘yieldparams’: The yielded blocks’ parameters.
- ‘yieldreturn’: The value returned by the block.
Finally, the method may have one or more overloads, which replace or
supplement the method with alternative signatures or documentation.
- ‘overloads’: The method overloads, if any. Each overload has the same
keys as a full method object.
Returns
- (Hash{String => Object}) — the representation of the method.
#class_method? => Boolean
Returns
- (Boolean) — true if the method is a class method; otherwise false.
#constructor? => Boolean
Also known as:
constructor
Returns
- (Boolean) — true if the method is a constructor; otherwise false.
#data_path => String
The path to the data file.
Returns
- (String) — the file path.
#description => String
The full description of the method, minus the first clause.
The remainder of the method description, if any, after subtracting the
short description (separated by the first paragraph break).
Returns
- (String) — the remaining description.
See Also
#instance_method? => Boolean
Returns
- (Boolean) — true if the method is an instance method; otherwise
false.
Additional metadata tags from the documentation.
#name => String
The full, qualified name of the method.
Returns
- (String) — the qualified name.
#options => Array<Hash>
The documented options of the method.
Each option is a Hash with the following keys:
- ‘name’: The name of the parameter.
- ‘type’: The JSON representation of the parsed Type object.
- ‘description’: The description of the parameter.
Returns
- (Array<Hash>) — the method options.
#overloaded? => true, false
Checks if the method has been completely overloaded.
A completely overloaded method has no description and no tags other than
exactly one @overload tag. This case is common when documenting a method
with a different signature.
Returns
- (true, false) — true if the method is completely overloaded;
otherwise false.
#overloads => Object
The documented overloads for the method.
Each overload is a JSON representation of a method, and includes the same
tags and properties (with the exception that an overload cannot itself
have overloads).
See Also
#params => Array<Hash>
The documented parameters of the method.
Each parameter is a Hash with the following keys:
- ‘name’: The name of the parameter.
- ‘type’: The JSON representation of the parsed Type object.
- ‘description’: The description of the parameter.
Returns
- (Array<Hash>) — the method parameters.
#parent_path => String
The path to the defining class or module’s data file.
Returns
- (String) — the file path.
#raises => Array<Hash>
The documented raised exceptions of the method.
Each raised exception is a Hash with the following keys:
- ‘type’: The type of exception raised.
- ‘description’: The description of the exception, or details on when the
exception is raised.
Returns
- (Array<Hash>) — the exceptions raised.by the method.
#returns => Array<Hash>
The return type or types of the method.
Each return type or types is a Hash with the following keys:
- ‘type’: The JSON representation of the parsed Type object.
- ‘description’: The description of the returned type, or details on when
that type will be returned.
Returns
- (Array<Hash>) — the return types of the method.
See Also
#short_description => String
A short description of the method.
The first part of the method description, separated by the first
paragraph break. Typically should fit on a single line of text.
Returns
- (String) — the short description.
See Also
#signature => String
The name and parameters of the method.
Returns
- (String) — the method signature.
#slug => String
The name of the method in url-safe format.
Returns
- (String) — the method name.
#yield_params => Array<Hash>
The parameters of the yielded to the block.
Each parameter is a Hash with the following keys:
- ‘name’: The name of the parameter.
- ‘type’: The JSON representation of the parsed Type object.
- ‘description’: The description of the parameter.
Returns
- (Array<Hash>) — the yielded parameters.
#yield_returns => Array<Hash>
The return type or types of the yielded block.
Each return type or types is a Hash with the following keys:
- ‘type’: The JSON representation of the parsed Type object.
- ‘description’: The description of the returned type, or details on when
that type will be returned.
Returns
- (Array<Hash>) — the return types of the yielded block.
See Also
#yields => Array<Hash>
The yielded block or blocks of method.
Each yielded block is a Hash with the following keys:
- ‘description’: The description of the yielded block or details on when
the block will be yielded.
- ‘parameters’: (Optional) The parameters yielded to the block.
Returns
- (Array<Hash>) — the yielded blocks.
See Also
- #yieldparams
- #yieldreturns
Back To Top
Back to
Documentation |
Reference
|
SleepingKingStudios
|
SleepingKingStudios::Docs
|
SleepingKingStudios::Docs::Data