Sha256: 495d206e4ce400f8f3dcdbc1fbb47417e1cb85e70bdeba88a801be82fcbbbc2d

Contents?: true

Size: 746 Bytes

Versions: 7

Compression:

Stored size: 746 Bytes

Contents

# frozen_string_literal: true
require_relative './udents_db.rb'

class StudentListDB
  attr_accessor :database

  @@instance = nil

  def self.instance
    @@instance ||= StudentListDB.new
  end


  def initialize
    self.database = StudentDB.new()
  end

  def get_student(id)
    Student.from_hash(database.select_by_id(id).transform_keys(&:to_sym))
  end

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

  def replace_student(id, student)
    database.replace_by_id(id, student)
  end

  def add_student(student)
    database.add_student(student.to_hash)
  end

  def get_students_pag(k, n, data)
    database.get_students_pag(k, n, data)
  end

  def count
    database.count
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
mc_gem3-1.0.0 lib/source/student_list_db.rb
mvcStudentXD-1.2.3 lib/source/database/student_list_db.rb
mvcStudentXD-1.2.2 lib/source/database/student_list_db.rb
mvcStudentXD-1.2.1 mvcStudentXD/lib/source/database/student_list_db.rb
mvcStudentXD-1.2.0 lib/source/database/student_list_db.rb
mvcStudentXD-1.1.3 lib/source/database/student_list_db.rb
model_XD-0.1.0 lib/database/student_list_db.rb