Sha256: e732bbdfc3fef8325010fbb6a43b8445fa0417df1c7af20aa66cc9c68e92378c
Contents?: true
Size: 592 Bytes
Versions: 20
Compression:
Stored size: 592 Bytes
Contents
# frozen_string_literal: true 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
20 entries across 20 versions & 2 rubygems