Method: Bike::Parser.scrape_label

Defined in:
lib/_parser.rb

.scrape_label(html) ⇒ Object



116
117
118
119
120
121
122
123
124
# File 'lib/_parser.rb', line 116

def scrape_label(html)
  if html.sub!(/\A((?:[^<]*<!--)?[^<]*<[^>]*title=")([^"]+)/, '\\1')
    label_plural = $2.to_s.split(/,/).collect {|s| s.strip }
    label_plural *= 4 if label_plural.size == 1
    label = label_plural.first
    Bike::I18n.msg[label] ||= label_plural
    label
  end
end