editor_learner 1.0.3 → 1.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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/editor_learner/version.rb +1 -1
- data/lib/editor_learner.rb +19 -10
- data/lib/random_check_question/10.rb +16 -0
- data/lib/random_check_question/11.rb +7 -0
- data/lib/random_check_question/12.rb +10 -0
- data/lib/random_check_question/13.rb +6 -0
- data/lib/random_check_question/13.rb~ +5 -0
- data/lib/random_check_question/14.rb +23 -0
- data/lib/random_check_question/14.rb~ +23 -0
- data/lib/random_check_question/15.rb +11 -0
- data/lib/random_check_question/15.rb~ +11 -0
- data/lib/random_check_question/3.rb +6 -1
- data/lib/random_check_question/5.rb +15 -0
- data/lib/random_check_question/6.rb +6 -0
- data/lib/random_check_question/7.rb +8 -0
- data/lib/random_check_question/8.rb +6 -0
- data/lib/random_check_question/9.rb +15 -0
- data/workshop/#answer.rb# +22 -1
- data/workshop/#question.rb# +22 -0
- data/workshop/answer.rb +7 -0
- data/workshop/question.rb +7 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34b1a9ee92900289af8b264ae2558c6640e66ee7
|
4
|
+
data.tar.gz: cfbe53da6322e42c5fd20162f5a548300d151e7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a83648d15236870c24c0e61d551cb27bc509c8991be534a0ab8e79f4e0012c8eac23d27265b2ec8f58cdf33d87484479bf0b12ac40d22204908cc466bf7e4680
|
7
|
+
data.tar.gz: 57be04741605f7c05087605c50ea7c7332782a37a0a64f73aefd5a313094fdbccfdebe10d64ddf6550eecd53bdcc4bcc9b532a534bc5337b77b32aa26a5cacef
|
data/Gemfile.lock
CHANGED
data/lib/editor_learner.rb
CHANGED
@@ -106,7 +106,7 @@ class CLI < Thor
|
|
106
106
|
|
107
107
|
desc 'random_check', 'ramdom check your typing and edit skill.'
|
108
108
|
def random_check(*argv)
|
109
|
-
random = rand(1..
|
109
|
+
random = rand(1..15)
|
110
110
|
p random
|
111
111
|
s = "#{random}.rb"
|
112
112
|
puts "check starting ..."
|
@@ -114,25 +114,34 @@ class CLI < Thor
|
|
114
114
|
puts "> emacs question.rb answer.rb"
|
115
115
|
|
116
116
|
src_dir = File.expand_path('../..', __FILE__) # "Users/souki/editor_learner"
|
117
|
-
|
118
|
-
|
117
|
+
if File.exist?("#{@inject}/random_check_question/#{s}") == true then
|
118
|
+
FileUtils.cp("#{@inject}/random_check_question/#{s}", "#{@prac_dir}/question.rb")
|
119
|
+
elsif
|
120
|
+
FileUtils.cp(File.join(src_dir, "lib/random_check_question/#{s}"), "#{@prac_dir}/question.rb")
|
121
|
+
end
|
119
122
|
open_terminal
|
120
|
-
|
123
|
+
|
121
124
|
start_time = Time.now
|
122
125
|
loop do
|
123
|
-
|
124
|
-
if
|
125
|
-
|
126
|
-
|
126
|
+
a = STDIN.gets.chomp
|
127
|
+
if a == "check" && FileUtils.compare_file("#{@prac_dir}/question.rb", "#{@prac_dir}/answer.rb") == true then
|
128
|
+
puts "It have been finished!"
|
129
|
+
break
|
130
|
+
elsif FileUtils.compare_file("#{@prac_dir}/question.rb", "#{@prac_dir}/answer.rb") != true then
|
131
|
+
@inputdata = File.open("#{@prac_dir}/answer.rb").readlines
|
132
|
+
@checkdata = File.open("#{@prac_dir}/question.rb").readlines
|
133
|
+
diffs = Diff::LCS.diff("#{@inputdata}", "#{@checkdata}")
|
134
|
+
diffs.each do |diff|
|
135
|
+
p diff
|
127
136
|
end
|
128
137
|
end
|
129
138
|
end
|
130
139
|
end_time = Time.now
|
131
140
|
time = end_time - start_time - 1
|
132
|
-
|
141
|
+
|
133
142
|
puts "#{time} sec"
|
134
143
|
end
|
135
|
-
|
144
|
+
|
136
145
|
no_commands do
|
137
146
|
def open_terminal
|
138
147
|
pwd = Dir.pwd
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
class User
|
3
|
+
attr_reader :first_name, :last_name, :age
|
4
|
+
|
5
|
+
def initialize(first_name, last_name, age)
|
6
|
+
@first_name = first_name
|
7
|
+
@last_name = last_name
|
8
|
+
@age = age
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
users = []
|
13
|
+
users << User.new('Alice', 'Ruby', 20)
|
14
|
+
users << User.new('Bob', 'Python', 30)
|
15
|
+
|
16
|
+
def full_name(user)
|
17
|
+
"#{user.first_name} #{user.last_name}"
|
18
|
+
end
|
19
|
+
|
20
|
+
user.each do |user|
|
21
|
+
puts "氏名: #{full_name(user)}, 年齢: #{user.age}"
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
class User
|
3
|
+
attr_reader :first_name, :last_name, :age
|
4
|
+
|
5
|
+
def initialize(first_name, last_name, age)
|
6
|
+
@first_name = first_name
|
7
|
+
@last_name = last_name
|
8
|
+
@age = age
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
users = []
|
13
|
+
users << User.new('Alice', 'Ruby', 20)
|
14
|
+
users << User.new('Bob', 'Python', 30)
|
15
|
+
|
16
|
+
def full_name(user)
|
17
|
+
"#{user.first_name} #{user.last_name}"
|
18
|
+
end
|
19
|
+
|
20
|
+
user.each do |user|
|
21
|
+
puts"氏名: #{full_name(user)}, 年齢: #{user.age}"
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
def liquid?(temperature)
|
2
|
+
0 <= temperature && temperature < 100
|
3
|
+
end
|
4
|
+
liquid?(-1)
|
5
|
+
liquid?(0)
|
6
|
+
liquid?(99)
|
7
|
+
liquid?(100)
|
8
|
+
|
9
|
+
def liquid?(temperature)
|
10
|
+
(0...100).include?(temperature)
|
11
|
+
end
|
12
|
+
liquid?(-1)
|
13
|
+
liquid?(0)
|
14
|
+
liquid?(99)
|
15
|
+
liquid?(100)
|
data/workshop/#answer.rb#
CHANGED
@@ -1 +1,22 @@
|
|
1
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
class User
|
3
|
+
attr_reader :first_name, :last_name, :age
|
4
|
+
|
5
|
+
def initialize(first_name, last_name, age)
|
6
|
+
@first_name = first_name
|
7
|
+
@last_name = last_name
|
8
|
+
@age = age
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
users = []
|
13
|
+
users << User.new('Alice', 'Ruby', 20)
|
14
|
+
users << User.new('Bob', 'Python', 30)
|
15
|
+
|
16
|
+
def full_name(user)
|
17
|
+
"#{user.first_name} #{user.last_name}"
|
18
|
+
end
|
19
|
+
|
20
|
+
user.each do |user|
|
21
|
+
puts"氏名: #{full_name(user)}, 年齢: #{user.age}"
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
class User
|
3
|
+
attr_reader :first_name, :last_name, :age
|
4
|
+
|
5
|
+
def initialize(first_name, last_name, age)
|
6
|
+
@first_name = first_name
|
7
|
+
@last_name = last_name
|
8
|
+
@age = age
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
users = []
|
13
|
+
users << User.new('Alice', 'Ruby', 20)
|
14
|
+
users << User.new('Bob', 'Python', 30)
|
15
|
+
|
16
|
+
def full_name(user)
|
17
|
+
"#{user.first_name} #{user.last_name}"
|
18
|
+
end
|
19
|
+
|
20
|
+
user.each do |user|
|
21
|
+
puts"氏名: #{full_name(user)}, 年齢: #{user.age}"
|
22
|
+
end
|
data/workshop/answer.rb
CHANGED
data/workshop/question.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: editor_learner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Souki Wada
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -154,9 +154,23 @@ files:
|
|
154
154
|
- lib/question/test/3.rb
|
155
155
|
- lib/question/test/4.rb
|
156
156
|
- lib/random_check_question/1.rb
|
157
|
+
- lib/random_check_question/10.rb
|
158
|
+
- lib/random_check_question/11.rb
|
159
|
+
- lib/random_check_question/12.rb
|
160
|
+
- lib/random_check_question/13.rb
|
161
|
+
- lib/random_check_question/13.rb~
|
162
|
+
- lib/random_check_question/14.rb
|
163
|
+
- lib/random_check_question/14.rb~
|
164
|
+
- lib/random_check_question/15.rb
|
165
|
+
- lib/random_check_question/15.rb~
|
157
166
|
- lib/random_check_question/2.rb
|
158
167
|
- lib/random_check_question/3.rb
|
159
168
|
- lib/random_check_question/4.rb
|
169
|
+
- lib/random_check_question/5.rb
|
170
|
+
- lib/random_check_question/6.rb
|
171
|
+
- lib/random_check_question/7.rb
|
172
|
+
- lib/random_check_question/8.rb
|
173
|
+
- lib/random_check_question/9.rb
|
160
174
|
- lib/random_h.rb
|
161
175
|
- lib/sequential_check_question/ruby_1/1.rb
|
162
176
|
- lib/sequential_check_question/ruby_1/2.rb
|
@@ -182,6 +196,7 @@ files:
|
|
182
196
|
- lib/sequential_h.rb
|
183
197
|
- question.rb
|
184
198
|
- workshop/#answer.rb#
|
199
|
+
- workshop/#question.rb#
|
185
200
|
- workshop/answer.rb
|
186
201
|
- workshop/question.rb
|
187
202
|
- workshop/random_h.rb
|