Sha256: 960febfe2f2a698d727b5db3e6bf958eec45ed03b2f81eea538aa4ab9dda9555
Contents?: true
Size: 1.88 KB
Versions: 3
Compression:
Stored size: 1.88 KB
Contents
module ShnaiderCode class StudentsListAdapter def get_student(id) end def remove_student(id) end def replace_student(id, student, data) end def get_students(from, to, data) end def add_student(student) end def count end end class StudentsListDBAdapter < StudentsListAdapter attr_private_accessor :database_list def initialize(database_list) self.database_list = database_list end def get_student(id) database_list.get_student(id) end def remove_student(id) database_list.remove_student(id) end def replace_student(id, student) database_list.replace_student(id, student) end def get_students(from, to) database_list.get_students_slice(from, to) end def add_student(student) database_list.add_student(student) end def count database_list.count() end end class StudentsListFormatterAdapter < StudentsListAdapter attr_private_accessor :formatter def initialize(formatter, filename) self.formatter = formatter formatter.read_from(filename) end def get_student(id) formatter.get_student(id) end def remove_student(id) formatter.delete_student(id) end def replace_student(id, student) formatter.replace_student(id, student) end def get_students(from, to) count = to - from k = from / count formatter.get_students_slice(k, count) end def add_student(student) formatter.add_student(student) end def count formatter.count() end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
shnaider_code-2.0.4 | lib/source/students_list_adapter.rb |
shnaider_code-2.0.3 | lib/source/students_list_adapter.rb |
shnaider_code-2.0.2 | lib/source/students_list_adapter.rb |