student_list_yaml 1.0.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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/student_list_yaml.rb +18 -0
  3. metadata +39 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b275ced7af5465f4b8515e8bca8354569443eac5e0c467130fda319f4120e625
4
+ data.tar.gz: 01d3e65119565931a4f67791bc99aa24c35c960c2084b084a401b711a36bfa1d
5
+ SHA512:
6
+ metadata.gz: fee440310432a08aaf374d4f3a588d7d0e45324c3e80492492ef246ac4056fa17d471d909bf6ee76c9e698c72d42b372bf4dbb7e3871b0ff224d2852516c718f
7
+ data.tar.gz: 69c282b6051145c733dd7a3eeb0fff7aae1a047a7dc6e46d3c7f74b428bef6ef811c47bd55bc5ed92d32cde28cb9912b4293c4552198cdef392c0683b4b9dbdb
@@ -0,0 +1,18 @@
1
+ require 'yaml'
2
+ require_relative 'student_list_yaml'
3
+
4
+ class StudentListYAML < StudentListBase
5
+ def read_from_file
6
+ if File.exist?(@file_path)
7
+ yaml_data = File.read(@file_path)
8
+ data_array = YAML.safe_load(yaml_data, permitted_classes: [Symbol], symbolize_names: true)
9
+ @students = data_array.map { |student_data| Student.new(**student_data) }
10
+ else
11
+ @students = []
12
+ end
13
+ end
14
+
15
+ def write_to_file
16
+ File.write(@file_path, students_to_hash.to_yaml)
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,39 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: student_list_yaml
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - dice365
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: YAML student
13
+ email: xz.unityhub@gmail.com
14
+ executables: []
15
+ extensions: []
16
+ extra_rdoc_files: []
17
+ files:
18
+ - lib/student_list_yaml.rb
19
+ licenses:
20
+ - MIT
21
+ metadata: {}
22
+ rdoc_options: []
23
+ require_paths:
24
+ - lib
25
+ required_ruby_version: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 3.0.0
30
+ required_rubygems_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ requirements: []
36
+ rubygems_version: 3.6.7
37
+ specification_version: 4
38
+ summary: YAML student
39
+ test_files: []