class Slippery::Processors::AddGoogleFont

Public Class Methods

new(font_name, variants = []) click to toggle source
# File lib/slippery/processors/add_google_font.rb, line 6
def initialize(font_name, variants = [])
  @font_name = font_name.freeze
  @variants  = variants.freeze
end

Public Instance Methods

call(doc) click to toggle source
# File lib/slippery/processors/add_google_font.rb, line 11
def call(doc)
  doc.rewrite('head', &add_font_link)
end
href() click to toggle source
# File lib/slippery/processors/add_google_font.rb, line 21
def href
  'http://fonts.googleapis.com/css?family=' +
    CGI.escape(@font_name) + (@variants.empty? ? '' : ':' + @variants.join(','))
end