Class: YARD::Handlers::Ruby::Legacy::ConstantHandler
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Base ,
::YARD::Handlers::Base
|
|
Instance Chain:
|
|
Inherits: |
YARD::Handlers::Ruby::Legacy::Base
|
Defined in: | lib/yard/handlers/ruby/legacy/constant_handler.rb |
Constant Summary
-
HANDLER_MATCH =
# File 'lib/yard/handlers/ruby/legacy/constant_handler.rb', line 5/\A[A-Z]\w*\s*=[^=]\s*/m
::YARD::CodeObjects
- Included
BUILTIN_ALL, BUILTIN_CLASSES, BUILTIN_EXCEPTIONS, BUILTIN_EXCEPTIONS_HASH, BUILTIN_MODULES, CONSTANTMATCH, CONSTANTSTART, CSEP, CSEPQ, ISEP, ISEPQ, METHODMATCH, METHODNAMEMATCH, NAMESPACEMATCH, NSEP, NSEPQ, PROXY_MATCH
::YARD::Parser::Ruby::Legacy::RubyToken
- Included
EXPR_ARG, EXPR_BEG, EXPR_CLASS, EXPR_DOT, EXPR_END, EXPR_FNAME, EXPR_MID, NEWLINE_TOKEN, TkReading2Token, TkSymbol2Token, TokenDefinitions
Class Attribute Summary
::YARD::Handlers::Base
- Inherited
.namespace_only | Declares that the handler should only be called when inside a |
.namespace_only? |
Class Method Summary
Base
- Inherited
::YARD::Handlers::Base
- Inherited
.clear_subclasses | Clear all registered subclasses. |
.handlers, | |
.handles | Declares the statement type which will be processed by this handler. |
.handles? | This class is implemented by |
.in_file | Declares that a handler should only be called when inside a filename by its basename or a regex match for the full path. |
.inherited, .matches_file?, .new, | |
.process | Generates a #process method, equivalent to +def process; ... |
.subclasses | Returns all registered handler subclasses. |
Instance Attribute Summary
::YARD::Handlers::Base
- Inherited
#extra_state | Share state across different handlers inside of a file. |
#globals |
|
#namespace, #namespace=, #owner, #owner=, #parser, #scope, #scope=, #statement, #visibility, #visibility= |
Instance Method Summary
-
#process ⇒ void
Main processing callback.
- #extract_parameters(parameters) private
- #process_structclass(classname, parameters) private
::YARD::Handlers::Ruby::StructHandlerMethods
- Included
#add_reader_tags | Creates the auto-generated docstring for the getter method of a struct's member. |
#add_writer_tags | Creates the auto-generated docstring for the setter method of a struct's member. |
#create_attributes | Creates the given member methods and attaches them to the given ClassObject. |
#create_class | Creates and registers a class object with the given name and superclass name. |
#create_member_method? | Determines whether to create an attribute method based on the class's tags. |
#create_reader | Creates the getter (reader) method and attaches it to the class as an attribute. |
#create_writer | Creates the setter (writer) method and attaches it to the class as an attribute. |
#member_tag_for_member | Extracts the user's defined @member tag for a given class and its member. |
#members_from_tags | Retrieves all members defined in @attr* tags. |
#return_type_from_tag | Gets the return type for the member in a nicely formatted string. |
Base
- Inherited
#call_params, #caller_method, | |
#parse_block | Parses a statement's block with a set of state values. |
#extract_method_details | Extracts method information for macro expansion only. |
#tokval | The string value of a token. |
#tokval_list | Returns a list of symbols or string values from a statement. |
::YARD::Parser::Ruby::Legacy::RubyToken
- Included
::YARD::Handlers::Base
- Inherited
#abort! | Aborts a handler by raising |
#call_params, #caller_method, | |
#ensure_loaded! | Ensures that a specific |
#parse_block | Parses the semantic "block" contained in the statement node. |
#process | The main handler method called by the parser on a statement that matches the |
#push_state | Executes a given block with specific state values for |
#register | Do some post processing on a list of code objects. |
#register_docstring | Registers any docstring found for the object and expands macros. |
#register_dynamic | Registers the object as dynamic if the object is defined inside a method or block (owner != namespace). |
#register_ensure_loaded | Ensures that the object's namespace is loaded before attaching it to the namespace. |
#register_file_info | Registers the file/line of the declaration with the object. |
#register_group | Registers the object as being inside a specific group. |
#register_module_function | Registers the same method information on the module function, if the object was defined as a module function. |
#register_source, | |
#register_transitive_tags | Registers any transitive tags from the namespace on the object. |
#register_visibility | Registers visibility on a method object. |
Constructor Details
This class inherits a constructor from YARD::Handlers::Base
Instance Method Details
#extract_parameters(parameters) (private)
[ GitHub ]
#process ⇒ void
This method returns an undefined value.
Main processing callback
# File 'lib/yard/handlers/ruby/legacy/constant_handler.rb', line 9
process do name, value = *statement.tokens.to_s.split(/\s*=\s*/, 2) if value =~ /\A\s*Struct.new(?:\s*\(?|\b)/ process_structclass(name, $') else register ConstantObject.new(namespace, name) {|o| o.source = statement; o.value = value.strip } end end
#process_structclass(classname, parameters) (private)
[ GitHub ]# File 'lib/yard/handlers/ruby/legacy/constant_handler.rb', line 20
def process_structclass(classname, parameters) klass = create_class(classname, P(:Struct)) create_attributes(klass, extract_parameters(parameters)) end