poj_org 0.2.0 → 0.2.1

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/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
- "http://poj.org/showsource?solution_id=#{id}"
54
+ PojOrg::Code.url_for id
46
55
  end
47
56
  end
@@ -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
- "http://poj.org/problem?id=#{id}"
39
+ PojOrg::Problem.url_for id
31
40
  end
32
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poj_org
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: