boj-solvedac 0.2.1 → 0.3.0
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.
- checksums.yaml +4 -4
- data/lib/boj-solvedac.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b00f463812297cb9cdb55639a511e4bc309f305836fd489d639c089ebeefca66
|
4
|
+
data.tar.gz: 788ccc75ecab48a649d22db13e4fe86d16774aafec56d344a90c189f03602ff2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cecc8e9cebc4aa1eadccceeea49e78202cbb94662cbcd8ea40e927a88c8cdb037503e1234c50cba5451605eefacb8110d75f74cc6dc5dac5a68321c22317f650
|
7
|
+
data.tar.gz: 976b1be13f808d0addc5cc57be1ed05802b8b3eebb4ae8c3f154ba2b9c4fb3b1c8f18625b9c37c6da00bfabc925f64976be0bdf2c96538c44fbb20ad694e6390
|
data/lib/boj-solvedac.rb
CHANGED
@@ -30,6 +30,7 @@ module BOJ
|
|
30
30
|
when 'stat' then command_stat(level)
|
31
31
|
when 'prob' then command_prob(level)
|
32
32
|
when 'random' then command_random(level)
|
33
|
+
when 'solved' then command_solved(level)
|
33
34
|
when 'clear' then system('clear')
|
34
35
|
when 'help' then command_help
|
35
36
|
when /exit|quit/ then exit(1)
|
@@ -144,6 +145,17 @@ module BOJ
|
|
144
145
|
puts
|
145
146
|
end
|
146
147
|
|
148
|
+
def command_solved(id)
|
149
|
+
path = 'stats/solved-problems.dat'
|
150
|
+
File.open(path, 'w') # create one if one doesn't exist
|
151
|
+
problems = IO.read(path).chomp
|
152
|
+
problems += " #{id}"
|
153
|
+
File.open(path, "w") do |f|
|
154
|
+
f.puts problems
|
155
|
+
end
|
156
|
+
fetch_solved_data
|
157
|
+
end
|
158
|
+
|
147
159
|
def command_help
|
148
160
|
puts '''
|
149
161
|
levels you can specify:
|
@@ -166,6 +178,9 @@ module BOJ
|
|
166
178
|
random --> randomly pick a problem from all levels
|
167
179
|
random [LEVEL] --> randomly pick a problem from [LEVEL]
|
168
180
|
* hit [ENTER] to repeat the previous \'random\' command
|
181
|
+
solved:
|
182
|
+
solved [ID] --> adds [ID] to \'solved-problems.dat\' and
|
183
|
+
updates the stat.
|
169
184
|
clear:
|
170
185
|
clear --> clears the screen
|
171
186
|
exit:
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boj-solvedac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jione Eu
|
@@ -10,7 +10,7 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2020-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: " version 0.
|
13
|
+
description: " version 0.3.x -> 'solved [ID]' method added. \n"
|
14
14
|
email:
|
15
15
|
executables: []
|
16
16
|
extensions: []
|