poj_org 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/poj_org/code.rb +10 -1
- data/lib/poj_org/problem.rb +10 -1
- metadata +1 -1
data/lib/poj_org/code.rb
CHANGED
@@ -3,6 +3,15 @@ require 'cgi'
|
|
3
3
|
|
4
4
|
# This class handles codes on poj.org
|
5
5
|
class PojOrg::Code
|
6
|
+
# Get the url of code via specified ID on poj.org
|
7
|
+
#
|
8
|
+
# @param [Integer] id ID of code
|
9
|
+
#
|
10
|
+
# @return [String] Url of code
|
11
|
+
def self.url_for(id)
|
12
|
+
"http://poj.org/showsource?solution_id=#{id}"
|
13
|
+
end
|
14
|
+
|
6
15
|
# @return [Integer] ID of code
|
7
16
|
attr_accessor :id
|
8
17
|
|
@@ -42,6 +51,6 @@ class PojOrg::Code
|
|
42
51
|
#
|
43
52
|
# @return [String] Url of code
|
44
53
|
def url
|
45
|
-
|
54
|
+
PojOrg::Code.url_for id
|
46
55
|
end
|
47
56
|
end
|
data/lib/poj_org/problem.rb
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# This class handles problems on poj.org
|
2
2
|
class PojOrg::Problem
|
3
|
+
# Get the url of problem via specified ID on poj.org
|
4
|
+
#
|
5
|
+
# @param [Integer] id ID of problem
|
6
|
+
#
|
7
|
+
# @return [String] Url of problem
|
8
|
+
def self.url_for(id)
|
9
|
+
"http://poj.org/problem?id=#{id}"
|
10
|
+
end
|
11
|
+
|
3
12
|
# @return [Integer] ID of problem
|
4
13
|
attr_accessor :id
|
5
14
|
|
@@ -27,6 +36,6 @@ class PojOrg::Problem
|
|
27
36
|
#
|
28
37
|
# @return [String] Url of problem
|
29
38
|
def url
|
30
|
-
|
39
|
+
PojOrg::Problem.url_for id
|
31
40
|
end
|
32
41
|
end
|