Class: Glyphs::Configuration
- Inherits:
-
Object
- Object
- Glyphs::Configuration
- Defined in:
- lib/glyphs/configuration.rb
Constant Summary collapse
- DEFAULT_FALLBACK_ICONS =
{ lucide: "circle-question-mark", phosphor: "question", heroicons: "question-mark-circle" }.freeze
Instance Attribute Summary collapse
-
#cache_svgs ⇒ Object
raise_on_missing: boolean; when true, Icons::IconNotFound is re-raised.
-
#fallback_icons ⇒ Object
raise_on_missing: boolean; when true, Icons::IconNotFound is re-raised.
-
#keep_icons ⇒ Object
raise_on_missing: boolean; when true, Icons::IconNotFound is re-raised.
-
#on_missing_icon ⇒ Object
raise_on_missing: boolean; when true, Icons::IconNotFound is re-raised.
-
#prune_source_globs ⇒ Object
raise_on_missing: boolean; when true, Icons::IconNotFound is re-raised.
-
#raise_on_missing ⇒ Object
raise_on_missing: boolean; when true, Icons::IconNotFound is re-raised.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
26 27 28 29 30 31 32 33 |
# File 'lib/glyphs/configuration.rb', line 26 def initialize @raise_on_missing = defined?(Rails) ? Rails.env.local? : true @on_missing_icon = nil @fallback_icons = DEFAULT_FALLBACK_ICONS.dup @cache_svgs = true @keep_icons = [] @prune_source_globs = nil end |
Instance Attribute Details
#cache_svgs ⇒ Object
raise_on_missing: boolean; when true, Icons::IconNotFound is re-raised. Defaults to true in local Rails environments (and outside Rails). on_missing_icon: optional callable(error, name:, library:, variant:), invoked before the fallback renders when not raising. fallback_icons: { library => icon_name } rendered instead of a missing icon. cache_svgs: memoize rendered SVG strings per [library, variant, name, attributes]. keep_icons: icons the pruner must keep despite no static reference (dynamic / data-driven names). A flat list of names/globs, or a { library => [names/globs] } hash. fallback_icons are always kept. prune_source_globs: extra locations the pruner's scanner text-scans IN ADDITION to the built-in Ruby/template defaults — e.g. a config file that names icons. Never replaces the defaults (nil = defaults only).
23 24 25 |
# File 'lib/glyphs/configuration.rb', line 23 def cache_svgs @cache_svgs end |
#fallback_icons ⇒ Object
raise_on_missing: boolean; when true, Icons::IconNotFound is re-raised. Defaults to true in local Rails environments (and outside Rails). on_missing_icon: optional callable(error, name:, library:, variant:), invoked before the fallback renders when not raising. fallback_icons: { library => icon_name } rendered instead of a missing icon. cache_svgs: memoize rendered SVG strings per [library, variant, name, attributes]. keep_icons: icons the pruner must keep despite no static reference (dynamic / data-driven names). A flat list of names/globs, or a { library => [names/globs] } hash. fallback_icons are always kept. prune_source_globs: extra locations the pruner's scanner text-scans IN ADDITION to the built-in Ruby/template defaults — e.g. a config file that names icons. Never replaces the defaults (nil = defaults only).
23 24 25 |
# File 'lib/glyphs/configuration.rb', line 23 def fallback_icons @fallback_icons end |
#keep_icons ⇒ Object
raise_on_missing: boolean; when true, Icons::IconNotFound is re-raised. Defaults to true in local Rails environments (and outside Rails). on_missing_icon: optional callable(error, name:, library:, variant:), invoked before the fallback renders when not raising. fallback_icons: { library => icon_name } rendered instead of a missing icon. cache_svgs: memoize rendered SVG strings per [library, variant, name, attributes]. keep_icons: icons the pruner must keep despite no static reference (dynamic / data-driven names). A flat list of names/globs, or a { library => [names/globs] } hash. fallback_icons are always kept. prune_source_globs: extra locations the pruner's scanner text-scans IN ADDITION to the built-in Ruby/template defaults — e.g. a config file that names icons. Never replaces the defaults (nil = defaults only).
23 24 25 |
# File 'lib/glyphs/configuration.rb', line 23 def keep_icons @keep_icons end |
#on_missing_icon ⇒ Object
raise_on_missing: boolean; when true, Icons::IconNotFound is re-raised. Defaults to true in local Rails environments (and outside Rails). on_missing_icon: optional callable(error, name:, library:, variant:), invoked before the fallback renders when not raising. fallback_icons: { library => icon_name } rendered instead of a missing icon. cache_svgs: memoize rendered SVG strings per [library, variant, name, attributes]. keep_icons: icons the pruner must keep despite no static reference (dynamic / data-driven names). A flat list of names/globs, or a { library => [names/globs] } hash. fallback_icons are always kept. prune_source_globs: extra locations the pruner's scanner text-scans IN ADDITION to the built-in Ruby/template defaults — e.g. a config file that names icons. Never replaces the defaults (nil = defaults only).
23 24 25 |
# File 'lib/glyphs/configuration.rb', line 23 def on_missing_icon @on_missing_icon end |
#prune_source_globs ⇒ Object
raise_on_missing: boolean; when true, Icons::IconNotFound is re-raised. Defaults to true in local Rails environments (and outside Rails). on_missing_icon: optional callable(error, name:, library:, variant:), invoked before the fallback renders when not raising. fallback_icons: { library => icon_name } rendered instead of a missing icon. cache_svgs: memoize rendered SVG strings per [library, variant, name, attributes]. keep_icons: icons the pruner must keep despite no static reference (dynamic / data-driven names). A flat list of names/globs, or a { library => [names/globs] } hash. fallback_icons are always kept. prune_source_globs: extra locations the pruner's scanner text-scans IN ADDITION to the built-in Ruby/template defaults — e.g. a config file that names icons. Never replaces the defaults (nil = defaults only).
23 24 25 |
# File 'lib/glyphs/configuration.rb', line 23 def prune_source_globs @prune_source_globs end |
#raise_on_missing ⇒ Object
raise_on_missing: boolean; when true, Icons::IconNotFound is re-raised. Defaults to true in local Rails environments (and outside Rails). on_missing_icon: optional callable(error, name:, library:, variant:), invoked before the fallback renders when not raising. fallback_icons: { library => icon_name } rendered instead of a missing icon. cache_svgs: memoize rendered SVG strings per [library, variant, name, attributes]. keep_icons: icons the pruner must keep despite no static reference (dynamic / data-driven names). A flat list of names/globs, or a { library => [names/globs] } hash. fallback_icons are always kept. prune_source_globs: extra locations the pruner's scanner text-scans IN ADDITION to the built-in Ruby/template defaults — e.g. a config file that names icons. Never replaces the defaults (nil = defaults only).
23 24 25 |
# File 'lib/glyphs/configuration.rb', line 23 def raise_on_missing @raise_on_missing end |