ashcards 0.1.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 +7 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +4 -0
- data/lib/ashcards/card.rb +32 -0
- data/lib/ashcards/collection.rb +80 -0
- data/lib/ashcards/collections.rb +19 -0
- data/lib/ashcards/version.rb +5 -0
- data/lib/ashcards/window_modified.rb +269 -0
- data/lib/ashcards.rb +94 -0
- data/sig/ashcards.rbs +4 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 46a9e085e29bec6bc7859755d89a2c26f1d9d3374e9a9f32dc384cc0ff7e6035
|
4
|
+
data.tar.gz: 475eb874cbfd42e4d42638d47516178c442c72356cb52f608ab087c58465cc20
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ae0622b354dcb977ac2e6208b2a2b5ab58b1a510fefcdf95136dce38766953c5c53e6de5e326e801058870fc2f359dacd9d3b0f5669958a0095cf64bc9c6d1d4
|
7
|
+
data.tar.gz: 124a6dfef7cdc009814363dfdcbab95b5638e4033d177ce22b1bcdf29823e59fa616fe80388994a9fbf074f4c30728ceec57b87c3755dfa8f836b6fb38d07eb9
|
data/CHANGELOG.md
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2025 Marigold
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Ashcards
|
2
|
+
|
3
|
+
TODO: Delete this and the text below, and describe your gem
|
4
|
+
|
5
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ashcards`. To experiment with that code, run `bin/console` for an interactive prompt.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
10
|
+
|
11
|
+
Install the gem and add to the application's Gemfile by executing:
|
12
|
+
|
13
|
+
```bash
|
14
|
+
bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
|
15
|
+
```
|
16
|
+
|
17
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
18
|
+
|
19
|
+
```bash
|
20
|
+
gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
|
21
|
+
```
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ashcards.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
class Card
|
4
|
+
attr_reader :word, :meaning, :date
|
5
|
+
|
6
|
+
def initialize(id, word, meaning, date, ease)
|
7
|
+
@id = id
|
8
|
+
@word = word
|
9
|
+
@meaning = meaning
|
10
|
+
@date = Date.parse(date)
|
11
|
+
@ease = ease.to_i
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_date
|
15
|
+
@date
|
16
|
+
end
|
17
|
+
|
18
|
+
def correct_ease
|
19
|
+
@ease = (1.5 * @ease).floor + 1
|
20
|
+
@date = Date.today + @ease
|
21
|
+
end
|
22
|
+
|
23
|
+
def incorrect_ease
|
24
|
+
@ease = 0
|
25
|
+
@date = Date.today
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_s
|
29
|
+
"#{@word} | #{@meaning} | #{@date} | #{@ease}\n"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'date'
|
2
|
+
require_relative 'card.rb'
|
3
|
+
|
4
|
+
class Collection
|
5
|
+
attr_reader :name, :cards, :dues
|
6
|
+
|
7
|
+
def initialize(name, cards=[], dues=[])
|
8
|
+
@name = name
|
9
|
+
@cards = cards
|
10
|
+
@dues = dues
|
11
|
+
end
|
12
|
+
|
13
|
+
# add card to the cards list
|
14
|
+
def add_card(card)
|
15
|
+
@cards << card
|
16
|
+
end
|
17
|
+
|
18
|
+
# adds a due card to the dues list
|
19
|
+
def add_due(due)
|
20
|
+
@dues << due
|
21
|
+
end
|
22
|
+
|
23
|
+
def remove_due(due)
|
24
|
+
@dues.delete(due)
|
25
|
+
end
|
26
|
+
|
27
|
+
def delay_due(due)
|
28
|
+
@dues.insert(-1, @dues.delete(due))
|
29
|
+
end
|
30
|
+
|
31
|
+
def search_date
|
32
|
+
matches = []
|
33
|
+
@cards.each do |card|
|
34
|
+
if (card.get_date <=> Date.today) == -1 || (card.get_date <=> Date.today) == 0
|
35
|
+
matches << card
|
36
|
+
end
|
37
|
+
end
|
38
|
+
return matches
|
39
|
+
end
|
40
|
+
|
41
|
+
# gets all cards in collection file
|
42
|
+
def find_cards
|
43
|
+
File.foreach("./collections/" + @name + ".data").with_index do |line, idx|
|
44
|
+
# if line is NOT empty, then add card
|
45
|
+
unless line.chomp.empty?
|
46
|
+
card_data = line.split("|")
|
47
|
+
card = Card.new(idx, card_data[0].chomp.strip, card_data[1].chomp.strip, card_data[2].chomp.strip, card_data[3].chomp.strip)
|
48
|
+
self.add_card card
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def find_dues
|
54
|
+
@dues = self.search_date
|
55
|
+
end
|
56
|
+
|
57
|
+
def write
|
58
|
+
File.write("./collections/" + @name + ".data", "")
|
59
|
+
@cards.each do |card|
|
60
|
+
File.write("./collections/" + @name + ".data", card.to_s, mode: "a")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def to_s
|
65
|
+
"#{@name}: \n#{@cards}\n#{@dues}"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
if __FILE__ == $0
|
70
|
+
filenames = Dir.entries("./collections/")
|
71
|
+
filenames.each do |filename|
|
72
|
+
if filename.end_with? ".data"
|
73
|
+
collection = Collection.new filename[..-6]
|
74
|
+
collection.find_cards
|
75
|
+
collection.find_dues
|
76
|
+
puts collection
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require_relative 'collection.rb'
|
2
|
+
|
3
|
+
class Collections
|
4
|
+
def initialize(collections=[])
|
5
|
+
@collections = collections
|
6
|
+
end
|
7
|
+
|
8
|
+
def find_collections
|
9
|
+
filenames = Dir.entries("./collections/")
|
10
|
+
filenames.each do |filename|
|
11
|
+
if filename.end_with? ".data"
|
12
|
+
collection = Collection.new(filename[..-6])
|
13
|
+
@collections << collection
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_collections = @collections
|
19
|
+
end
|
@@ -0,0 +1,269 @@
|
|
1
|
+
require 'curses'
|
2
|
+
|
3
|
+
include Curses
|
4
|
+
|
5
|
+
class Window_Extra < Window
|
6
|
+
def draw_border
|
7
|
+
width = self.maxx
|
8
|
+
height = self.maxy
|
9
|
+
|
10
|
+
self.addstr "┌" + "─" * (width - 2) + "┐"
|
11
|
+
(height-2).times do |y|
|
12
|
+
self.setpos(y+1, 0)
|
13
|
+
self.addstr "│"
|
14
|
+
self.setpos(y+1, width-1)
|
15
|
+
self.addstr "│"
|
16
|
+
end
|
17
|
+
self.addstr "└" + "─" * (width - 2) + "┘"
|
18
|
+
end
|
19
|
+
|
20
|
+
def write_collection(collection, row)
|
21
|
+
self.attrset A_NORMAL
|
22
|
+
self.setpos(row, 3)
|
23
|
+
self.addstr collection.name
|
24
|
+
self.setpos(row, 31)
|
25
|
+
self.addstr collection.cards.length.to_s
|
26
|
+
self.setpos(row, 41)
|
27
|
+
self.addstr collection.dues.length.to_s
|
28
|
+
end
|
29
|
+
|
30
|
+
def become_collection_selection(collections)
|
31
|
+
init_pair(2, COLOR_BLUE, COLOR_BLACK)
|
32
|
+
|
33
|
+
self.draw_border
|
34
|
+
self.attrset A_BOLD
|
35
|
+
self.color_set 2
|
36
|
+
self.setpos(1,2)
|
37
|
+
self.addstr "Name"
|
38
|
+
self.setpos(1,31)
|
39
|
+
self.addstr "Total"
|
40
|
+
self.setpos(1,41)
|
41
|
+
self.addstr "Due"
|
42
|
+
|
43
|
+
collections.get_collections.each_with_index do |collection, idx|
|
44
|
+
self.write_collection(collection, idx + 2)
|
45
|
+
end
|
46
|
+
|
47
|
+
line_selected = 2
|
48
|
+
self.setpos(line_selected,2)
|
49
|
+
self.addstr "+"
|
50
|
+
end
|
51
|
+
|
52
|
+
def init_collection_selection
|
53
|
+
subwindow = self.subwin(self.maxy-2, 52, 1, (self.maxx-52)/2)
|
54
|
+
subwindow.draw_border
|
55
|
+
|
56
|
+
return subwindow
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class Ashcards_Window < Window_Extra
|
61
|
+
attr_accessor :collections
|
62
|
+
|
63
|
+
def measure_size
|
64
|
+
@width = Terminal.size[:width]
|
65
|
+
@height = Terminal.size[:height]
|
66
|
+
@line_selected = 0
|
67
|
+
end
|
68
|
+
|
69
|
+
def draw_select
|
70
|
+
measure_size
|
71
|
+
self.resize(@height - 2, 52)
|
72
|
+
self.move(1, (@width - 52) / 2)
|
73
|
+
self.draw_border
|
74
|
+
|
75
|
+
init_pair(1, 15, 0)
|
76
|
+
init_pair(2, COLOR_BLUE, COLOR_BLACK)
|
77
|
+
init_pair(3, 0, 15)
|
78
|
+
|
79
|
+
self.attrset A_BOLD
|
80
|
+
self.color_set 2
|
81
|
+
self.setpos(1,2)
|
82
|
+
self.addstr "Name"
|
83
|
+
self.setpos(1,31)
|
84
|
+
self.addstr "Total"
|
85
|
+
self.setpos(1,41)
|
86
|
+
self.addstr "Due"
|
87
|
+
|
88
|
+
self.attrset A_NORMAL
|
89
|
+
self.color_set 1
|
90
|
+
self.setpos(self.maxy - 1, 2)
|
91
|
+
self.addstr "┤Q to quit├"
|
92
|
+
self.setpos(self.maxy - 1, 14)
|
93
|
+
self.addstr "┤↑ to up├"
|
94
|
+
self.setpos(self.maxy - 1, 24)
|
95
|
+
self.addstr "┤↓ to down├"
|
96
|
+
|
97
|
+
@collections.get_collections.each_with_index do |collection, idx|
|
98
|
+
self.write_collection(collection, idx + 2)
|
99
|
+
end
|
100
|
+
|
101
|
+
self.setpos(2, 2)
|
102
|
+
self.addstr "+"
|
103
|
+
@line_selected = 2
|
104
|
+
end
|
105
|
+
|
106
|
+
def draw_test
|
107
|
+
measure_size
|
108
|
+
self.resize(9, 29)
|
109
|
+
self.attrset A_NORMAL
|
110
|
+
self.draw_border
|
111
|
+
self.move((@height - 9) / 2, (@width - 29) / 2)
|
112
|
+
|
113
|
+
self.attrset A_BOLD
|
114
|
+
self.setpos(9/2-1, (29-2 - @word.length)/2+1)
|
115
|
+
self.addstr @word
|
116
|
+
self.attrset A_DIM
|
117
|
+
self.setpos(9/2+1, 29/2)
|
118
|
+
self.addstr "?"
|
119
|
+
self.attrset A_NORMAL
|
120
|
+
end
|
121
|
+
|
122
|
+
def quit
|
123
|
+
confirm_window = Window_Extra.new(7, 40, (@height-7)/2, (@width-40)/2)
|
124
|
+
confirm_window.draw_border
|
125
|
+
message = "Are you sure you want to quit?"
|
126
|
+
confirm_window.setpos(2, (40-message.length)/2)
|
127
|
+
confirm_window.addstr message
|
128
|
+
confirm_window.color_set 3
|
129
|
+
confirm_window.setpos(4, 40/2+10-4)
|
130
|
+
confirm_window.addstr ' No[ANY] '
|
131
|
+
confirm_window.setpos(4, 40/2-10-4)
|
132
|
+
confirm_window.addstr ' Yes[Q] '
|
133
|
+
case confirm_window.getch.to_s
|
134
|
+
when 'Q', 'q'
|
135
|
+
exit
|
136
|
+
else
|
137
|
+
confirm_window.clear
|
138
|
+
confirm_window.refresh
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
|
143
|
+
def run
|
144
|
+
measure_size
|
145
|
+
@line_selected = 2
|
146
|
+
select
|
147
|
+
end
|
148
|
+
|
149
|
+
def select
|
150
|
+
draw_select
|
151
|
+
loop do
|
152
|
+
key = self.getch
|
153
|
+
case key.to_s
|
154
|
+
when '27'
|
155
|
+
case self.getch.to_s
|
156
|
+
when '['
|
157
|
+
case self.getch.to_s
|
158
|
+
when 'B'
|
159
|
+
unless @line_selected+1 > collections.get_collections.length+1
|
160
|
+
self.setpos(@line_selected, 2)
|
161
|
+
self.addstr " "
|
162
|
+
@line_selected += 1
|
163
|
+
end
|
164
|
+
when 'A'
|
165
|
+
unless @line_selected-1 < 2
|
166
|
+
self.setpos(@line_selected, 2)
|
167
|
+
self.addstr " "
|
168
|
+
@line_selected -= 1
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
when 'Q', 'q'
|
173
|
+
quit
|
174
|
+
when ' ', '10'
|
175
|
+
test
|
176
|
+
self.clear
|
177
|
+
self.refresh
|
178
|
+
draw_select
|
179
|
+
when '410'
|
180
|
+
self.clear
|
181
|
+
self.refresh
|
182
|
+
draw_select
|
183
|
+
else
|
184
|
+
self.addstr key.to_s
|
185
|
+
end
|
186
|
+
self.setpos(@line_selected,2)
|
187
|
+
self.addstr "+"
|
188
|
+
self.refresh
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
def test
|
193
|
+
collection = @collections.get_collections[@line_selected - 2]
|
194
|
+
while collection.dues.length > 0
|
195
|
+
due = collection.dues[0]
|
196
|
+
@word = due.word
|
197
|
+
@meaning = due.meaning
|
198
|
+
|
199
|
+
self.clear
|
200
|
+
self.refresh
|
201
|
+
draw_test
|
202
|
+
|
203
|
+
self.attrset A_BOLD
|
204
|
+
self.setpos(9/2-1, (29-2 - @word.length)/2+1)
|
205
|
+
self.addstr @word
|
206
|
+
self.attrset A_DIM
|
207
|
+
self.setpos(9/2+1, 29/2)
|
208
|
+
self.addstr "?"
|
209
|
+
loop do
|
210
|
+
c = self.getch
|
211
|
+
case c.to_s
|
212
|
+
when 'Q', 'q'
|
213
|
+
collection.write
|
214
|
+
quit
|
215
|
+
self.clear
|
216
|
+
self.refresh
|
217
|
+
draw_test
|
218
|
+
when ' ', '10'
|
219
|
+
self.setpos(9/2+1, (29-2 - @meaning.length)/2+1)
|
220
|
+
self.addstr @meaning
|
221
|
+
case self.getch.to_s
|
222
|
+
when ' ', '10'
|
223
|
+
due.correct_ease
|
224
|
+
collection.remove_due(due)
|
225
|
+
break
|
226
|
+
when '2'
|
227
|
+
due.incorrect_ease
|
228
|
+
collection.delay_due(due)
|
229
|
+
break
|
230
|
+
when '27'
|
231
|
+
case self.getch.to_s
|
232
|
+
when '['
|
233
|
+
case self.getch.to_s
|
234
|
+
when 'D'
|
235
|
+
collection.write
|
236
|
+
return
|
237
|
+
end
|
238
|
+
end
|
239
|
+
else
|
240
|
+
end
|
241
|
+
when 'H'
|
242
|
+
self.attrset A_NORMAL
|
243
|
+
self.setpos(9/2+1, 1)
|
244
|
+
self.addstr " "*(29-2)
|
245
|
+
|
246
|
+
self.attrset A_DIM
|
247
|
+
self.setpos(9/2+1, 29/2)
|
248
|
+
self.addstr "?"
|
249
|
+
when '410'
|
250
|
+
draw_test
|
251
|
+
when '27'
|
252
|
+
case self.getch.to_s
|
253
|
+
when '['
|
254
|
+
case self.getch.to_s
|
255
|
+
when 'D'
|
256
|
+
collection.write
|
257
|
+
return
|
258
|
+
end
|
259
|
+
end
|
260
|
+
else
|
261
|
+
self.addstr c.to_s
|
262
|
+
end
|
263
|
+
self.refresh
|
264
|
+
end
|
265
|
+
end
|
266
|
+
collection.write
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
data/lib/ashcards.rb
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "ashcards/version"
|
4
|
+
require 'curses'
|
5
|
+
require 'terminal-size'
|
6
|
+
require_relative 'ashcards/collections.rb'
|
7
|
+
require_relative 'ashcards/window_modified.rb'
|
8
|
+
|
9
|
+
include Curses
|
10
|
+
|
11
|
+
module Ashcards
|
12
|
+
class Error < StandardError; end
|
13
|
+
collections = Collections.new
|
14
|
+
collections.find_collections
|
15
|
+
collections.get_collections.each do |collection|
|
16
|
+
collection.find_cards
|
17
|
+
collection.find_dues
|
18
|
+
end
|
19
|
+
|
20
|
+
init_screen
|
21
|
+
start_color
|
22
|
+
curs_set(0)
|
23
|
+
noecho
|
24
|
+
init_pair(1, 1, 0)
|
25
|
+
init_pair(2, COLOR_BLUE, COLOR_BLACK)
|
26
|
+
init_pair(3, 0, 15)
|
27
|
+
crmode
|
28
|
+
|
29
|
+
begin
|
30
|
+
win = Ashcards_Window.new(0,0,0,0)
|
31
|
+
win.collections = collections
|
32
|
+
win.run
|
33
|
+
|
34
|
+
subwindow = win.init_collection_selection
|
35
|
+
subwindow.become_collection_selection(collections)
|
36
|
+
|
37
|
+
line_selected = 2
|
38
|
+
|
39
|
+
loop do
|
40
|
+
key = subwindow.getch
|
41
|
+
case key.to_s
|
42
|
+
when '27'
|
43
|
+
case subwindow.getch.to_s
|
44
|
+
when '['
|
45
|
+
case subwindow.getch.to_s
|
46
|
+
when 'B'
|
47
|
+
unless line_selected+1 > collections.get_collections.length+1
|
48
|
+
subwindow.setpos(line_selected, 2)
|
49
|
+
subwindow.addstr " "
|
50
|
+
line_selected += 1
|
51
|
+
end
|
52
|
+
when 'A'
|
53
|
+
unless line_selected-1 < 2
|
54
|
+
subwindow.setpos(line_selected, 2)
|
55
|
+
subwindow.addstr " "
|
56
|
+
line_selected -= 1
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
when 'Q', 'q'
|
61
|
+
confirm_window = win.subwin(7, 40, (win.maxy-7)/2, (win.maxx-40)/2)
|
62
|
+
confirm_window.draw_border
|
63
|
+
message = "Are you sure you want to quit?"
|
64
|
+
confirm_window.setpos(2, (40-message.length)/2)
|
65
|
+
confirm_window.addstr message
|
66
|
+
confirm_window.color_set 3
|
67
|
+
confirm_window.setpos(4, 40/2+10-4)
|
68
|
+
confirm_window.addstr ' No[ANY] '
|
69
|
+
confirm_window.setpos(4, 40/2-10-4)
|
70
|
+
confirm_window.addstr ' Yes[Q] '
|
71
|
+
case confirm_window.getch.to_s
|
72
|
+
when 'Q', 'q', '10'
|
73
|
+
exit
|
74
|
+
else
|
75
|
+
confirm_window.clear
|
76
|
+
confirm_window.refresh
|
77
|
+
end
|
78
|
+
when '10'
|
79
|
+
when '410'
|
80
|
+
win.resize(Terminal.size[:height], Terminal.size[:width])
|
81
|
+
subwindow.close
|
82
|
+
subwindow.refresh
|
83
|
+
subwindow = win.init_collection_selection
|
84
|
+
subwindow.become_collection_selection(collections)
|
85
|
+
else
|
86
|
+
subwindow.addstr key.to_s
|
87
|
+
end
|
88
|
+
subwindow.setpos(line_selected,2)
|
89
|
+
subwindow.addstr "+"
|
90
|
+
subwindow.refresh
|
91
|
+
end
|
92
|
+
ensure
|
93
|
+
end
|
94
|
+
end
|
data/sig/ashcards.rbs
ADDED
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ashcards
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- marigold
|
8
|
+
bindir: exe
|
9
|
+
cert_chain: []
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
|
+
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: terminal-size
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - "~>"
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: 0.0.6
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - "~>"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: 0.0.6
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: curses
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.5.0
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 1.5.0
|
40
|
+
description: Application that lets you study flashcards on the terminal, Anki-style.
|
41
|
+
email:
|
42
|
+
- marigoldyyellow@gmail.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- CHANGELOG.md
|
48
|
+
- LICENSE.txt
|
49
|
+
- README.md
|
50
|
+
- Rakefile
|
51
|
+
- lib/ashcards.rb
|
52
|
+
- lib/ashcards/card.rb
|
53
|
+
- lib/ashcards/collection.rb
|
54
|
+
- lib/ashcards/collections.rb
|
55
|
+
- lib/ashcards/version.rb
|
56
|
+
- lib/ashcards/window_modified.rb
|
57
|
+
- sig/ashcards.rbs
|
58
|
+
homepage: https://rubygems.org/gems/ashcards
|
59
|
+
licenses:
|
60
|
+
- MIT
|
61
|
+
metadata:
|
62
|
+
homepage_uri: https://rubygems.org/gems/ashcards
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 3.4.4
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubygems_version: 3.6.7
|
78
|
+
specification_version: 4
|
79
|
+
summary: Flashcards for you terminal
|
80
|
+
test_files: []
|