Class: StudentsListFormatterAdapter
- Inherits:
-
StudentsListAdapter
- Object
- StudentsListAdapter
- StudentsListFormatterAdapter
- Defined in:
- lib/model_gem_source/students_list_adapter.rb
Instance Method Summary collapse
- #add_student(student) ⇒ Object
- #count ⇒ Object
- #get_student(id) ⇒ Object
- #get_students(from, to) ⇒ Object
-
#initialize(formatter, filename) ⇒ StudentsListFormatterAdapter
constructor
A new instance of StudentsListFormatterAdapter.
- #remove_student(id) ⇒ Object
- #replace_student(id, student) ⇒ Object
Constructor Details
#initialize(formatter, filename) ⇒ StudentsListFormatterAdapter
Returns a new instance of StudentsListFormatterAdapter.
56 57 58 59 |
# File 'lib/model_gem_source/students_list_adapter.rb', line 56 def initialize(formatter, filename) self.formatter = formatter formatter.read_from(filename) end |
Instance Method Details
#add_student(student) ⇒ Object
80 81 82 |
# File 'lib/model_gem_source/students_list_adapter.rb', line 80 def add_student(student) formatter.add_student(student) end |
#count ⇒ Object
84 85 86 |
# File 'lib/model_gem_source/students_list_adapter.rb', line 84 def count formatter.count() end |
#get_student(id) ⇒ Object
61 62 63 |
# File 'lib/model_gem_source/students_list_adapter.rb', line 61 def get_student(id) formatter.get_student(id) end |
#get_students(from, to) ⇒ Object
73 74 75 76 77 78 |
# File 'lib/model_gem_source/students_list_adapter.rb', line 73 def get_students(from, to) count = to - from k = from / count formatter.get_students_slice(k, count) end |
#remove_student(id) ⇒ Object
65 66 67 |
# File 'lib/model_gem_source/students_list_adapter.rb', line 65 def remove_student(id) formatter.delete_student(id) end |
#replace_student(id, student) ⇒ Object
69 70 71 |
# File 'lib/model_gem_source/students_list_adapter.rb', line 69 def replace_student(id, student) formatter.replace_student(id, student) end |