12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/heroicons_helper.rb', line 12
def heroicon(name, variant:, size: nil, **attributes)
cache_key = HeroiconsHelper::Cache.get_key(
name: name,
variant: variant,
size: size,
attributes: attributes,
)
cached_heroicon = HeroiconsHelper::Cache.read(cache_key)
return cached_heroicon unless cached_heroicon.nil?
heroicon = ::HeroiconsHelper::Icon.new(name, variant, size: size, attributes: attributes)
HeroiconsHelper::Cache.set(cache_key, heroicon)
heroicon
end
|