xkcd 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/xkcd.rb +10 -1
- metadata +5 -5
data/lib/xkcd.rb
CHANGED
@@ -1,8 +1,17 @@
|
|
1
1
|
#!/usr/bin/evn ruby
|
2
2
|
require 'net/http'
|
3
3
|
require 'open-uri'
|
4
|
+
# The main XKCD driver
|
4
5
|
class XKCD
|
5
|
-
|
6
|
+
# Get img/comic URL from xkcd
|
7
|
+
#
|
8
|
+
# Example:
|
9
|
+
# >> XKCD.img
|
10
|
+
# => "http://imgs.xkcd.com/comics/hell.png"
|
11
|
+
#
|
12
|
+
# >> XKCD.comic
|
13
|
+
# => "http://xkcd.com/891/"
|
14
|
+
|
6
15
|
def self.comic()
|
7
16
|
# This method gets random comic links from xkcd, the uri is the redirected location found in the resp headers
|
8
17
|
uri = URI.parse 'http://dynamic.xkcd.com/random/comic/'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xkcd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Hemanth.HM
|
@@ -18,7 +18,7 @@ cert_chain: []
|
|
18
18
|
date: 2012-05-20 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
|
-
description: A simple gem to get random img url from xkcd
|
21
|
+
description: A simple gem to get random img/comic url from xkcd
|
22
22
|
email: hemanth.hm@gmail.com
|
23
23
|
executables: []
|
24
24
|
|
@@ -63,6 +63,6 @@ rubyforge_project:
|
|
63
63
|
rubygems_version: 1.8.24
|
64
64
|
signing_key:
|
65
65
|
specification_version: 3
|
66
|
-
summary: XCKD
|
66
|
+
summary: XCKD random img urls!
|
67
67
|
test_files:
|
68
68
|
- test/test_karam.rb
|