my_students 1.0.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.
- checksums.yaml +7 -0
- data/lib/my_students/version.rb +5 -0
- data/lib/my_students.rb +10 -0
- data/lib/source/controllers/student_contact_form_controller.rb +40 -0
- data/lib/source/controllers/student_create_form_controller.rb +48 -0
- data/lib/source/controllers/student_edit_form_controller.rb +45 -0
- data/lib/source/controllers/student_git_form_controller.rb +40 -0
- data/lib/source/controllers/student_list_controller.rb +112 -0
- data/lib/source/gui/logic_window.rb +187 -0
- data/lib/source/gui/main_window.rb +26 -0
- data/lib/source/gui/student_create_form.rb +70 -0
- data/lib/source/gui/test.rb +32 -0
- data/lib/source/logger/logger_holder.rb +23 -0
- data/lib/source/models/student.rb +163 -0
- data/lib/source/models/student_short.rb +56 -0
- data/lib/source/repositories/containers/data_list.rb +67 -0
- data/lib/source/repositories/containers/data_list_student_short.rb +18 -0
- data/lib/source/repositories/containers/data_table.rb +38 -0
- data/lib/source/repositories/data_sources/strategy/student_list_json.rb +16 -0
- data/lib/source/repositories/data_sources/strategy/student_list_txt.rb +39 -0
- data/lib/source/repositories/data_sources/strategy/student_list_yaml.rb +17 -0
- data/lib/source/repositories/data_sources/student_list_base.rb +91 -0
- data/lib/source/repositories/data_sources/student_list_strategy.rb +12 -0
- data/lib/source/repositories/db_university.rb +28 -0
- data/lib/source/repositories/student_list.rb +40 -0
- data/lib/source/repositories/student_list_db_adapter.rb +75 -0
- data/lib/source/repositories/student_list_file_adapter.rb +42 -0
- data/my_students.gemspec +17 -0
- data/sig/my_students.rbs +4 -0
- metadata +85 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require_relative 'data_sources/student_list_base'
|
|
3
|
+
|
|
4
|
+
class StudentListFileAdapter
|
|
5
|
+
def initialize(data_type, file_path)
|
|
6
|
+
@file = StudentListBase.new(data_type)
|
|
7
|
+
@file.load_from_file(file_path)
|
|
8
|
+
@file_path = file_path
|
|
9
|
+
end
|
|
10
|
+
# получить студента по id
|
|
11
|
+
def student_by_id(student_id)
|
|
12
|
+
@file.student_by_id(student_id)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
#добавление студента
|
|
16
|
+
def add_student(student)
|
|
17
|
+
@file.add_student(student)
|
|
18
|
+
@file.save_to_file(@file_path)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
#удаление студента по id
|
|
22
|
+
def remove_student(student_id)
|
|
23
|
+
@file.remove_student(student_id)
|
|
24
|
+
@file.save_to_file(@file_path)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
#замена студента по id
|
|
28
|
+
def replace_student(student_id, student)
|
|
29
|
+
@file.replace_student(student_id,student)
|
|
30
|
+
@file.save_to_file(@file_path)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
#подсчет количества студентов
|
|
34
|
+
def student_count
|
|
35
|
+
@file.student_count
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
#получение n элементов k страницы
|
|
39
|
+
def k_n_student_short_list(k,n, data_list)
|
|
40
|
+
@file.k_n_student_short_list(k, n, data_list)
|
|
41
|
+
end
|
|
42
|
+
end
|
data/my_students.gemspec
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "lib/my_students/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "my_students"
|
|
7
|
+
spec.version = MyStudents::VERSION
|
|
8
|
+
spec.authors = ["waasabi13"]
|
|
9
|
+
spec.email = ["kirilltitoff@mail.ru"]
|
|
10
|
+
spec.summary = "Student App"
|
|
11
|
+
spec.description = "А gem that allows you to get pass for patterns"
|
|
12
|
+
spec.homepage = "https://github.com/waasabi13/ruby_labs"
|
|
13
|
+
spec.license = "MIT"
|
|
14
|
+
spec.required_ruby_version = ">= 3.2.0"
|
|
15
|
+
spec.add_dependency 'sqlite3'
|
|
16
|
+
spec.files = Dir.glob("**/*")
|
|
17
|
+
end
|
data/sig/my_students.rbs
ADDED
metadata
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: my_students
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- waasabi13
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2023-05-22 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: sqlite3
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
description: А gem that allows you to get pass for patterns
|
|
28
|
+
email:
|
|
29
|
+
- kirilltitoff@mail.ru
|
|
30
|
+
executables: []
|
|
31
|
+
extensions: []
|
|
32
|
+
extra_rdoc_files: []
|
|
33
|
+
files:
|
|
34
|
+
- lib/my_students.rb
|
|
35
|
+
- lib/my_students/version.rb
|
|
36
|
+
- lib/source/controllers/student_contact_form_controller.rb
|
|
37
|
+
- lib/source/controllers/student_create_form_controller.rb
|
|
38
|
+
- lib/source/controllers/student_edit_form_controller.rb
|
|
39
|
+
- lib/source/controllers/student_git_form_controller.rb
|
|
40
|
+
- lib/source/controllers/student_list_controller.rb
|
|
41
|
+
- lib/source/gui/logic_window.rb
|
|
42
|
+
- lib/source/gui/main_window.rb
|
|
43
|
+
- lib/source/gui/student_create_form.rb
|
|
44
|
+
- lib/source/gui/test.rb
|
|
45
|
+
- lib/source/logger/logger_holder.rb
|
|
46
|
+
- lib/source/models/student.rb
|
|
47
|
+
- lib/source/models/student_short.rb
|
|
48
|
+
- lib/source/repositories/containers/data_list.rb
|
|
49
|
+
- lib/source/repositories/containers/data_list_student_short.rb
|
|
50
|
+
- lib/source/repositories/containers/data_table.rb
|
|
51
|
+
- lib/source/repositories/data_sources/strategy/student_list_json.rb
|
|
52
|
+
- lib/source/repositories/data_sources/strategy/student_list_txt.rb
|
|
53
|
+
- lib/source/repositories/data_sources/strategy/student_list_yaml.rb
|
|
54
|
+
- lib/source/repositories/data_sources/student_list_base.rb
|
|
55
|
+
- lib/source/repositories/data_sources/student_list_strategy.rb
|
|
56
|
+
- lib/source/repositories/db_university.rb
|
|
57
|
+
- lib/source/repositories/student_list.rb
|
|
58
|
+
- lib/source/repositories/student_list_db_adapter.rb
|
|
59
|
+
- lib/source/repositories/student_list_file_adapter.rb
|
|
60
|
+
- my_students.gemspec
|
|
61
|
+
- sig/my_students.rbs
|
|
62
|
+
homepage: https://github.com/waasabi13/ruby_labs
|
|
63
|
+
licenses:
|
|
64
|
+
- MIT
|
|
65
|
+
metadata: {}
|
|
66
|
+
post_install_message:
|
|
67
|
+
rdoc_options: []
|
|
68
|
+
require_paths:
|
|
69
|
+
- lib
|
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: 3.2.0
|
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
|
+
requirements:
|
|
77
|
+
- - ">="
|
|
78
|
+
- !ruby/object:Gem::Version
|
|
79
|
+
version: '0'
|
|
80
|
+
requirements: []
|
|
81
|
+
rubygems_version: 3.0.3.1
|
|
82
|
+
signing_key:
|
|
83
|
+
specification_version: 4
|
|
84
|
+
summary: Student App
|
|
85
|
+
test_files: []
|