Class: StudentRepository

Inherits:
Object
  • Object
show all
Defined in:
lib/repositories/student_repository.rb

Instance Method Summary collapse

Constructor Details

#initialize(data_source_adapter) ⇒ StudentRepository

Returns a new instance of StudentRepository.



4
5
6
# File 'lib/repositories/student_repository.rb', line 4

def initialize(data_source_adapter)
  @data_source_adapter = data_source_adapter
end

Instance Method Details

#add_student(student) ⇒ Object



17
18
19
# File 'lib/repositories/student_repository.rb', line 17

def add_student(student)
  @data_source_adapter.add_student(student)
end

#paginated_short_students(page, count, existing_data_list = nil) ⇒ Object

Получить page по счету count элементов (страница начинается с 1)



13
14
15
# File 'lib/repositories/student_repository.rb', line 13

def paginated_short_students(page, count, existing_data_list = nil)
  @data_source_adapter.paginated_short_students(page, count, existing_data_list)
end

#remove_student(student_id) ⇒ Object



25
26
27
# File 'lib/repositories/student_repository.rb', line 25

def remove_student(student_id)
  @data_source_adapter.remove_student(student_id)
end

#replace_student(student_id, student) ⇒ Object



21
22
23
# File 'lib/repositories/student_repository.rb', line 21

def replace_student(student_id, student)
  @data_source_adapter.replace_student(student_id, student)
end

#student_by_id(student_id) ⇒ Object



8
9
10
# File 'lib/repositories/student_repository.rb', line 8

def student_by_id(student_id)
  @data_source_adapter.student_by_id(student_id)
end

#student_countObject



29
30
31
# File 'lib/repositories/student_repository.rb', line 29

def student_count
  @data_source_adapter.student_count
end