def glyph(name, size = '')
      size =
          case size.to_s.downcase
            when 'small', 'sm'
              'glyphicon-small'
            when 'large', 'lg'
              'glyphicon-large'
            else
              nil
          end

      name = name.to_s.strip
      return nil if name.blank?

      result = '<i class="glyphicon glyphicon-' + CGI::escape_html(name)
      result += ' ' + size unless size.blank?
      result += '"></i>'
      result.html_safe
    end
def glyph(name, size = '')
      size =
          case size.to_s.downcase
            when 'small', 'sm'
              'glyphicon-small'
            when 'large', 'lg'
              'glyphicon-large'
            else
              nil
          end

      name = name.to_s.strip
      return nil if name.blank?

      result = '<i class="glyphicon glyphicon-' + CGI::escape_html(name)
      result += ' ' + size unless size.blank?
      result += '"></i>'
      result.html_safe
    end
Shows a glyph with an optional size.

 The glyph +name+ should be a valid {bootstrap glyph}[http://getbootstrap.com/components/#glyphicons] name.
 Strip the prefixed 'glyphicon-' from the name.

 The size can be left blank, or set to 'small' or 'large'.

   glyph('cloud')    # '<i class="glyphicon glyphicon-cloud"></i>'