Module: Yard::Yaml::Plugin

Defined in:
lib/yard/yaml/plugin.rb

Overview

Plugin activation for yard-yaml (Phase 3: config + discovery; still no YARD registrations).

Class Method Summary collapse

Class Method Details

.__reset_state__Object

Test-helper: reset internal activation flag.
Not part of public API; used from test teardown to avoid state leakage.



53
54
55
56
# File 'lib/yard/yaml/plugin.rb', line 53

def __reset_state__
  @activated = false
  nil
end

.activate(argv = nil) ⇒ void

This method returns an undefined value.

Activate the plugin.

Phase 3 behavior:

  • Parse argv for --yard_yaml-* flags and apply to configuration.
  • Run discovery to collect YAML pages and mirror to registry store.
  • Do NOT register tags, templates, or handlers yet.

Parameters:

  • argv (Array<String>, nil) (defaults to: nil)

    optional argument vector to parse



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/yard/yaml/plugin.rb', line 27

def activate(argv = nil)
  # Parse and apply CLI overrides if provided
  begin
    overrides = Cli.parse(argv || [])
    Yard::Yaml.configure(overrides) unless overrides.empty?
  rescue StandardError
    # Parsing failures should not prevent activation in Phase 3
  end

  # Collect pages via discovery using current config
  begin
    pages = Discovery.collect(Yard::Yaml.config)
    Yard::Yaml.__set_pages__(pages)
  rescue Yard::Yaml::Error
    # strict mode surfaced an error; re-raise to fail activation/build
    raise
  rescue StandardError
    # Non-strict errors are already warned by converter/discovery
  end

  @activated = true
  nil
end

.activated?Boolean

Whether the plugin has been activated for the current process.
Activation is explicit; requiring this file does not activate anything.

Returns:

  • (Boolean)


14
15
16
# File 'lib/yard/yaml/plugin.rb', line 14

def activated?
  @activated
end