Class: ShnaiderCode::YamlStudentsListFormatStrategy

Inherits:
StudentsListFormatStrategy show all
Defined in:
lib/source/students_list_format_strategy.rb

Instance Method Summary collapse

Instance Method Details

#read_from(filename) ⇒ Object



49
50
51
# File 'lib/source/students_list_format_strategy.rb', line 49

def read_from(filename)
    YAML.load_file(filename)
end

#write_to(filename, students) ⇒ Object



53
54
55
56
57
# File 'lib/source/students_list_format_strategy.rb', line 53

def write_to(filename, students)
    File.open(filename, 'w') do |file|
        file.write(students.to_yaml)
    end
end