favico 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/favico/parser.rb +9 -0
- data/lib/favico/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69045da5e817e08dbc1801b47d31e9d2f2475851
|
4
|
+
data.tar.gz: c0b8a2823f510ea2c04311130f322c8cbc5f387e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4f49a3a80efa7fedca644786a240a81e0bbde3d4d2c2919b92fe7510e44c66d9a47e00c6b9e6ef9d05c13577cf0366ab0958df2b99cdaf03ee06f280757ab5e
|
7
|
+
data.tar.gz: 3e6b1fba68c8cfe788746fc87c50c679b465b8b2ec7dd9ce693bf358e9cbbfef746c55601919b9b81da12458d93f72737efac1202d36518c041b8565629dc968
|
data/README.md
CHANGED
@@ -3,8 +3,10 @@ with a fairly simple interface. Mostly created because I was slightly bored.
|
|
3
3
|
|
4
4
|
```
|
5
5
|
fparser = Favicon::Parser.new
|
6
|
-
fparser.
|
6
|
+
fparser.fetch_favicon_url("http://www.google.com")
|
7
7
|
=> "http://www.google.com/favicon.ico"
|
8
|
+
fparser.fetch_favicon("http://www.google.com")
|
9
|
+
=> "<raw binary for favicon>"
|
8
10
|
```
|
9
11
|
|
10
12
|
That's about it. It'll be useful for creating your own favicon fetcher or something
|
data/lib/favico/parser.rb
CHANGED
@@ -12,6 +12,15 @@ module Favico
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def fetch_favicon(url)
|
15
|
+
favicon_url = fetch_favicon_url(url)
|
16
|
+
response = self.class.get(favicon_url)
|
17
|
+
if not response.nil? && response.code == 200
|
18
|
+
return response.body
|
19
|
+
end
|
20
|
+
nil
|
21
|
+
end
|
22
|
+
|
23
|
+
def fetch_favicon_url(url)
|
15
24
|
if root_favicon?(url)
|
16
25
|
return url + "/favicon.ico"
|
17
26
|
end
|
data/lib/favico/version.rb
CHANGED