Class: Docscribe::Plugin::Context
- Inherits:
-
Struct
- Object
- Struct
- Docscribe::Plugin::Context
- Defined in:
- lib/docscribe/plugin/context.rb
Overview
Snapshot of everything known about a method at doc-generation time.
Passed to every registered TagPlugin. Read-only — plugins must not mutate the context.
Instance Attribute Summary collapse
-
#container ⇒ String
E.g.
-
#inferred_params ⇒ Hash{String => String}
Name => inferred type.
-
#inferred_return ⇒ String
Inferred return type.
- #method_name ⇒ Symbol
-
#node ⇒ Parser::AST::Node
The :def or :defs AST node.
-
#scope ⇒ Symbol
:instance or :class.
-
#source ⇒ String
Raw method source text.
-
#visibility ⇒ Symbol
:public, :protected, or :private.
Instance Attribute Details
#container ⇒ String
Returns e.g. “MyModule::MyClass” or “Object” for top-level.
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/docscribe/plugin/context.rb', line 26 Context = Struct.new( :node, :container, :scope, :visibility, :method_name, :inferred_params, :inferred_return, :source, keyword_init: true ) |
#inferred_params ⇒ Hash{String => String}
Returns name => inferred type.
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/docscribe/plugin/context.rb', line 26 Context = Struct.new( :node, :container, :scope, :visibility, :method_name, :inferred_params, :inferred_return, :source, keyword_init: true ) |
#inferred_return ⇒ String
Returns inferred return type.
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/docscribe/plugin/context.rb', line 26 Context = Struct.new( :node, :container, :scope, :visibility, :method_name, :inferred_params, :inferred_return, :source, keyword_init: true ) |
#method_name ⇒ Symbol
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/docscribe/plugin/context.rb', line 26 Context = Struct.new( :node, :container, :scope, :visibility, :method_name, :inferred_params, :inferred_return, :source, keyword_init: true ) |
#node ⇒ Parser::AST::Node
Returns the :def or :defs AST node.
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/docscribe/plugin/context.rb', line 26 Context = Struct.new( :node, :container, :scope, :visibility, :method_name, :inferred_params, :inferred_return, :source, keyword_init: true ) |
#scope ⇒ Symbol
Returns :instance or :class.
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/docscribe/plugin/context.rb', line 26 Context = Struct.new( :node, :container, :scope, :visibility, :method_name, :inferred_params, :inferred_return, :source, keyword_init: true ) |
#source ⇒ String
Returns raw method source text.
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/docscribe/plugin/context.rb', line 26 Context = Struct.new( :node, :container, :scope, :visibility, :method_name, :inferred_params, :inferred_return, :source, keyword_init: true ) |
#visibility ⇒ Symbol
Returns :public, :protected, or :private.
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/docscribe/plugin/context.rb', line 26 Context = Struct.new( :node, :container, :scope, :visibility, :method_name, :inferred_params, :inferred_return, :source, keyword_init: true ) |