html_page_title 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +16 -3
- data/VERSION +1 -1
- data/html_page_title.gemspec +2 -2
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
gem install html_page_title
|
4
4
|
|
5
5
|
A simple class for finding the title of a given http url by fetching the
|
6
|
-
|
7
|
-
hpricot.
|
6
|
+
url, following all eventual redirects (with redirect_follower Rubygem)
|
7
|
+
and finally parsing it through hpricot.
|
8
8
|
|
9
9
|
You can either use the shorthand form or initialize the instance properly:
|
10
10
|
* HtmlPageTitle('http://github.com')
|
@@ -15,7 +15,7 @@ The shorthand form will swallow SocketErrors and return nil (i.e. this will
|
|
15
15
|
happen for invalid urls), while the regular instantiation via new will
|
16
16
|
throw that error.
|
17
17
|
|
18
|
-
|
18
|
+
After that you can either get the title, the heading (which will be the content of the
|
19
19
|
first h1 tag in the body) or the label, which will be (in the following order
|
20
20
|
by availability) either the heading, or the title, or the target url after
|
21
21
|
redirecting.
|
@@ -23,6 +23,19 @@ Note that if the title or the heading can not be found (e.g. a non-HTML
|
|
23
23
|
document), both methods will return nil, so the label method is the only one
|
24
24
|
that will always return some kind of string
|
25
25
|
|
26
|
+
== Usage example
|
27
|
+
|
28
|
+
>> require 'html_page_title'
|
29
|
+
>> t=HtmlPageTitle('http://tinyurl.com/2lekkm')
|
30
|
+
>> t.url
|
31
|
+
=> "http://github.com"
|
32
|
+
>> t.title
|
33
|
+
=> "Secure source code hosting and collaborative development - GitHub"
|
34
|
+
>> t.heading
|
35
|
+
=> "Unleash Your Code"
|
36
|
+
>> t.label
|
37
|
+
=> "Unleash Your Code"
|
38
|
+
|
26
39
|
You can also have a look at the unit test to find out about the behaviour!
|
27
40
|
|
28
41
|
== TODO:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/html_page_title.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{html_page_title}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Christoph Olszowka"]
|
12
|
-
s.date = %q{2010-07-
|
12
|
+
s.date = %q{2010-07-17}
|
13
13
|
s.description = %q{Retrieve the page title for a given url using redirect_follower and hpricot ruby gems}
|
14
14
|
s.email = %q{'christoph at olszowka.de'}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html_page_title
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Christoph Olszowka
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-07-
|
18
|
+
date: 2010-07-17 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|