Module: FluentIcons
- Includes:
- ActionView::Helpers::TagHelper
- Defined in:
- lib/fluent-icons.rb,
lib/fluent-icons/fluent.rb,
lib/fluent-icons/helper.rb,
lib/fluent-icons/railtie.rb,
lib/fluent-icons/version.rb
Defined Under Namespace
Constant Summary collapse
- SYMBOLS =
JSON.parse(data).freeze
- FLUENT_UI_ICONS_VERSION =
'1.1.261'.freeze
- VERSION =
'1.1.2.261'.freeze
Instance Method Summary collapse
- #clear_fluent_helper_cache ⇒ Object
- #fluent(symbol, options = {}, fallback_text = 'Error?') ⇒ Object (also: #fluent_icon)
Instance Method Details
#clear_fluent_helper_cache ⇒ Object
25 26 27 |
# File 'lib/fluent-icons/helper.rb', line 25 def clear_fluent_helper_cache fluent_helper_cache.clear end |
#fluent(symbol, options = {}, fallback_text = 'Error?') ⇒ Object Also known as: fluent_icon
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fluent-icons/helper.rb', line 9 def fluent(symbol, = {}, fallback_text = 'Error?') # return symbol.class.name if symbol.nil? || !symbol.is_a?(String) || !symbol.is_a?(Symbol) cache_key = [symbol, ] tag = fluent_helper_cache.dig(*cache_key) unless tag icon = FluentIcons::Fluent.new(symbol, ) tag = icon.to_svg fluent_helper_cache[cache_key] = tag end tag.html_safe end |