Class: HakumiComponents::Illustrations::Loader
- Inherits:
-
Object
- Object
- HakumiComponents::Illustrations::Loader
- Extended by:
- T::Sig
- Defined in:
- app/services/hakumi_components/illustrations/loader.rb
Constant Summary collapse
- Cache =
T.type_alias { T::Hash[String, T.nilable(ActiveSupport::SafeBuffer)] }
- ILLUSTRATIONS_PATH =
T.let( if defined?(HakumiComponents::Engine) HakumiComponents::Engine.root.join("app", "assets", "illustrations") else ::Rails.root.join("lib", "hakumi_components", "app", "assets", "illustrations") end, Pathname )
- @@cache =
T.let({}, Cache)
Class Method Summary collapse
Class Method Details
.clear_cache! ⇒ Object
27 28 29 |
# File 'app/services/hakumi_components/illustrations/loader.rb', line 27 def self.clear_cache! @@cache = {} end |
.load(name) ⇒ Object
21 22 23 24 |
# File 'app/services/hakumi_components/illustrations/loader.rb', line 21 def self.load(name) filename = "#{name}.svg" cache[filename] ||= read_svg(filename) end |