Sha256: 914e8bebcb0aa9d631ec569d1376a5c92c2315f141fbe28aa54b72e659e7d9cc
Contents?: true
Size: 757 Bytes
Versions: 5
Compression:
Stored size: 757 Bytes
Contents
require 'rubygems' require 'hpricot' module Murlsh # Hpricot:Doc mixin. module Doc # Get the character set of the document. def charset %w{content-type Content-Type}.each do |ct| content_type = at("meta[@http-equiv='#{ct}']") unless content_type.nil? content = content_type['content'] unless content.nil? charset = content[/charset=([\w_.:-]+)/, 1] return charset if charset end end end nil end # Find the title of the document. def title %w{//html/head/title //head/title //html/title //title}.each do |xpath| return (self/xpath).first.inner_html unless (self/xpath).first.nil? end nil end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
murlsh-0.6.1 | lib/murlsh/doc.rb |
murlsh-0.6.0 | lib/murlsh/doc.rb |
murlsh-0.5.2 | lib/murlsh/doc.rb |
murlsh-0.5.1 | lib/murlsh/doc.rb |
murlsh-0.5.0 | lib/murlsh/doc.rb |