Sha256: 35e42f2db007c1f56848d80dbcbaf7bc2bb3aa93eb183a4ae1924f06d1505ed3
Contents?: true
Size: 589 Bytes
Versions: 108
Compression:
Stored size: 589 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].to_s if octicons_helper_cache[cache_key] octicons_helper_cache[cache_key] 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
108 entries across 108 versions & 1 rubygems