Module: Rack::RackSeo::Sanitize

Included in:
Summarizer
Defined in:
lib/rack-seo/sanitize.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.sanitize_meta_title(title) ⇒ Object



2
3
4
# File 'lib/rack-seo/sanitize.rb', line 2

def self.sanitize_meta_title(title)
  title.to_s.gsub(/\s+/, ' ').strip
end

Instance Method Details

#sanitize_meta_description(meta_description) ⇒ Object



6
7
8
# File 'lib/rack-seo/sanitize.rb', line 6

def sanitize_meta_description(meta_description)
  meta_description.to_s.gsub(/[\s]+/, ' ').gsub(/[\r|\n]+/, ' ').strip
end

#sanitize_meta_keywords(keywords) ⇒ Object



10
11
12
13
14
# File 'lib/rack-seo/sanitize.rb', line 10

def sanitize_meta_keywords(keywords)
  keywords.split(",").collect { |keyword| 
    keyword.downcase.gsub(/\s+/, '')
  }.reject(&:empty?).join(',')
end