Sha256: c3a52206f087ceed7edd7b75b7c3b14ab7775d78853611c19eaef7d73d1d97e2

Contents?: true

Size: 937 Bytes

Versions: 6

Compression:

Stored size: 937 Bytes

Contents

require 'source/database/students_db.rb'

module McDelta
    class StudentsListDB    
        private_class_method :new

        def self.get_student(id)
            Student.from_json(StudentsListDB.database.select_by_id(id))
        end

        def self.remove_student(id)
            StudentsListDB.database.remove_by_id(id)
        end

        def self.replace_student(id, student)
            StudentsListDB.database.replace_by_id(id, student.as_json)
        end

        def self.add_student(student)
            StudentsListDB.database.add_student(student.as_json)
        end

        def self.get_students_slice(from, to)
            StudentsListDB.database.select_students(from, to).map { |x| Student.from_json(x) }
        end

        def self.count()
            StudentsListDB.database.count()
        end

        def self.database
            @database ||= StudentsDB.new()
            @database
        end
    end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
shnaider_code-2.0.1 lib/source/database/students_list_db.rb
shnaider_code-2.0.0 lib/source/database/students_list_db.rb
mc_delta-1.0.0 lib/source/database/students_list_db.rb
mc_delta-0.9.0 lib/source/database/students_list_db.rb
mc_delta-0.8.0 lib/source/database/students_list_db.rb
mc_delta-0.7.0 lib/source/database/students_list_db.rb