module Precious::Views::OcticonHelpers
Public Class Methods
included(base)
click to toggle source
# File lib/gollum/views/helpers.rb, line 72 def self.included(base) def rocticon(symbol, parameters = {}) Octicons::Octicon.new(symbol, parameters).to_svg end # Well-formed SVG with XMLNS and height/width removed, for use in CSS def rocticon_css(symbol, parameters = {}) octicon = ::Octicons::Octicon.new(symbol, parameters.merge({xmlns: 'http://www.w3.org/2000/svg'})) [:width, :height].each {|option| octicon.options.delete(option)} octicon.to_svg end def octicon lambda do |args| symbol, height, width, *cls = args.split(' ') parameters = {} parameters[:height] = height if height parameters[:width] = width if width parameters[:class] = cls.join(' ') if cls Octicons::Octicon.new(symbol, parameters).to_svg end end end
Public Instance Methods
octicon()
click to toggle source
# File lib/gollum/views/helpers.rb, line 85 def octicon lambda do |args| symbol, height, width, *cls = args.split(' ') parameters = {} parameters[:height] = height if height parameters[:width] = width if width parameters[:class] = cls.join(' ') if cls Octicons::Octicon.new(symbol, parameters).to_svg end end
rocticon(symbol, parameters = {})
click to toggle source
# File lib/gollum/views/helpers.rb, line 74 def rocticon(symbol, parameters = {}) Octicons::Octicon.new(symbol, parameters).to_svg end
rocticon_css(symbol, parameters = {})
click to toggle source
Well-formed SVG with XMLNS and height/width removed, for use in CSS
# File lib/gollum/views/helpers.rb, line 79 def rocticon_css(symbol, parameters = {}) octicon = ::Octicons::Octicon.new(symbol, parameters.merge({xmlns: 'http://www.w3.org/2000/svg'})) [:width, :height].each {|option| octicon.options.delete(option)} octicon.to_svg end