Module: Yard::Yaml
- Defined in:
- lib/yard/yaml.rb,
lib/yard/yaml/cli.rb,
lib/yard/yaml/tags.rb,
lib/yard/yaml/config.rb,
lib/yard/yaml/plugin.rb,
lib/yard/yaml/emitter.rb,
lib/yard/yaml/version.rb,
lib/yard/yaml/converter.rb,
lib/yard/yaml/discovery.rb,
lib/yard/yaml/templates.rb,
lib/yard/yaml/tag_renderer.rb,
lib/yard/yaml/template_helpers.rb
Defined Under Namespace
Modules: Cli, Discovery, Plugin, TagRenderer, Tags, TemplateHelpers, Templates, Version Classes: Config, Converter, Emitter, Error
Constant Summary collapse
- STATE =
{ config: nil, pages: nil, }
- STATE_MUTEX =
Mutex.new
- VERSION =
Traditional Constant Location
Version::VERSION
Class Method Summary collapse
-
.__reset_state__ ⇒ Object
Test-helper: reset memoized config to defaults (not public API).
-
.__set_pages__(list) ⇒ Object
Internal: set collected pages (used by Plugin during activation).
-
.config ⇒ Yard::Yaml::Config
Access the global configuration for yard-yaml.
-
.configure(overrides = nil) {|cfg| ... } ⇒ Yard::Yaml::Config
Configure the plugin programmatically.
-
.error(message) ⇒ Object
Public: emit an error-level log message (does not raise).
-
.pages ⇒ Array<Hash>?
Access collected pages (Phase 3).
-
.warn(message) ⇒ Object
Public: emit a warning message via YARD logger when available, otherwise stderr.
Class Method Details
.__reset_state__ ⇒ Object
Test-helper: reset memoized config to defaults (not public API)
92 93 94 95 96 97 98 99 100 101 |
# File 'lib/yard/yaml.rb', line 92 def __reset_state__ STATE_MUTEX.synchronize do STATE[:config] = nil STATE[:pages] = nil end if defined?(::Yard::Yaml::Plugin) && ::Yard::Yaml::Plugin.respond_to?(:__reset_state__) ::Yard::Yaml::Plugin.__reset_state__ end nil end |
.__set_pages__(list) ⇒ Object
Internal: set collected pages (used by Plugin during activation)
50 51 52 53 54 |
# File 'lib/yard/yaml.rb', line 50 def __set_pages__(list) pages = STATE_MUTEX.synchronize { STATE[:pages] = Array(list) } mirror_pages_to_registry(pages) pages end |
.config ⇒ Yard::Yaml::Config
Access the global configuration for yard-yaml.
Returns a memoized instance. It is safe to mutate via accessors in controlled contexts (e.g., tests or explicit configuration blocks).
38 39 40 |
# File 'lib/yard/yaml.rb', line 38 def config STATE[:config] || STATE_MUTEX.synchronize { STATE[:config] ||= Config.new } end |
.configure(overrides = nil) {|cfg| ... } ⇒ Yard::Yaml::Config
Configure the plugin programmatically.
61 62 63 64 65 66 67 |
# File 'lib/yard/yaml.rb', line 61 def configure(overrides = nil) cfg = config cfg.apply(overrides) if overrides && !overrides.empty? yield(cfg) if block_given? mirror_to_registry(cfg) cfg end |
.error(message) ⇒ Object
Public: emit an error-level log message (does not raise). Uses YARD::Logger.error if available, else falls back to stderr with prefix.
79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/yard/yaml.rb', line 79 def error() if defined?(::YARD) && ::YARD.const_defined?(:Logger) begin ::YARD::Logger.instance.error("yard-yaml: #{}") return rescue StandardError # fall back end end Kernel.warn("yard-yaml: ERROR: #{}") end |
.pages ⇒ Array<Hash>?
Access collected pages (Phase 3). Nil until plugin activation performs discovery. Each page is a Hash with keys: :path, :html, :title, :description, :meta
45 46 47 |
# File 'lib/yard/yaml.rb', line 45 def pages STATE[:pages] end |
.warn(message) ⇒ Object
Public: emit a warning message via YARD logger when available, otherwise stderr. Prefix is standardized to “yard-yaml: ”.
72 73 74 |
# File 'lib/yard/yaml.rb', line 72 def warn() __warn() end |