module OcticonsHelper

Constants

VERSION

Public Instance Methods

octicon(symbol, options = {}) click to toggle source
# File lib/octicons_helper/helper.rb, line 9
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