Module: GlyphHelper
- Defined in:
- app/helpers/glyph_helper.rb
Instance Method Summary collapse
-
#glyph(*names) ⇒ Object
Examples glyph(:share_alt) # => glyph(:lock, :white) # => glyph(:thumbs_up, :pull_left) # => glyph(:lock, :span) # => glyph(:lock, 'foo') # => .
Instance Method Details
#glyph(*names) ⇒ Object
Examples
glyph(:share_alt)
=>
glyph(:lock, :white)
=>
glyph(:thumbs_up, :pull_left)
=>
glyph(:lock, :span)
=>
glyph(:lock, 'foo')
=>
13 14 15 16 17 18 19 20 21 22 |
# File 'app/helpers/glyph_helper.rb', line 13 def glyph(*names) = names.last.kind_of?(Hash) ? names.pop : {} names.map! { |name| name.to_s.tr('_', '-') } names.map! do |name| name =~ /pull-(?:left|right)/ ? name : "glyphicon glyphicon-#{name}" end [:tag] = [:tag] ||= :i names.push [:class] || '' content_tag [:tag], nil, class: names end |