lib/urlize.rb in Urlize-0.0.0 vs lib/urlize.rb in Urlize-0.1.0

- old
+ new

@@ -10,18 +10,26 @@ :scheme => parsed_uri.scheme, :host => host, } output[:search_term] = self.humanize(query["q"]) if query.has_key?("q") output[:search_term] = self.humanize(query["p"]) if query.has_key?("p") - output.inspect + output end - def self.humanize(phrase) - if phrase.index("%20") - phrase = phrase.gsub(/%20/, " ") - phrase = phrase.gsub(/\+/, " ") - else - end - phrase[0] + def self.domain(url) + @parsed = self.read(url) + output = @parsed[:host] + output << " (#{@parsed[:search_term]})" if @parsed[:search_term] + output end + + protected + def self.humanize(phrase) + if phrase.index("%20") + phrase = phrase.gsub(/%20/, " ") + phrase = phrase.gsub(/\+/, " ") + else + end + phrase[0] + end end \ No newline at end of file