Sha256: 75515d0740a7d53315c72f6d5ec99c091cf779b24953102db4346ef0009ffcfb

Contents?: true

Size: 1.6 KB

Versions: 9

Compression:

Stored size: 1.6 KB

Contents

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

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
mc_delta-0.4.0 lib/source/students_list_adapter.rb
mc_delta-0.3.0 lib/source/students_list_adapter.rb
mc_delta-0.2.0 lib/source/students_list_adapter.rb
mc_delta-0.1.0 lib/source/students_list_adapter.rb
model_gem-0.2.0 lib/model_gem_source/students_list_adapter.rb
model_gem-0.1.9 lib/model_gem_source/students_list_adapter.rb
model_gem-0.1.8 lib/model_gem_source/students_list_adapter.rb
model_gem-0.1.7 ./model_gem_source/students_list_adapter.rb
model_gem-0.1.6 ./model_gem_source/students_list_adapter.rb