Sha256: bc0ecbd81530c3a973d54e1a3473d3a51043d764696742257aed47b1cce5ef5b
Contents?: true
Size: 561 Bytes
Versions: 342
Compression:
Stored size: 561 Bytes
Contents
require "octicons" require "action_view" module OcticonsHelper include ActionView::Helpers::TagHelper mattr_accessor :octicons_helper_cache, default: {} def octicon(symbol, options = {}) return "" if symbol.nil? cache_key = [symbol, options] if tag = octicons_helper_cache[cache_key] tag else icon = Octicons::Octicon.new(symbol, options) tag = content_tag(:svg, icon.path.html_safe, icon.options).freeze # rubocop:disable Rails/OutputSafety octicons_helper_cache[cache_key] = tag tag end end end
Version data entries
342 entries across 342 versions & 2 rubygems