Class: Docscribe::Plugin::Context

Inherits:
Struct
  • Object
show all
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

Instance Attribute Details

#containerString

Returns e.g. “MyModule::MyClass” or “Object” for top-level.

Returns:

  • (String)

    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_paramsHash{String => String}

Returns name => inferred type.

Returns:

  • (Hash{String => String})

    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_returnString

Returns inferred return type.

Returns:

  • (String)

    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_nameSymbol

Returns:

  • (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
)

#nodeParser::AST::Node

Returns the :def or :defs AST node.

Returns:

  • (Parser::AST::Node)

    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
)

#scopeSymbol

Returns :instance or :class.

Returns:

  • (Symbol)

    :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
)

#sourceString

Returns raw method source text.

Returns:

  • (String)

    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
)

#visibilitySymbol

Returns :public, :protected, or :private.

Returns:

  • (Symbol)

    :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
)