Class: StudentListYaml

Inherits:
StudentListStrategy show all
Defined in:
lib/source/strategy/student_list_yaml.rb

Instance Method Summary collapse

Instance Method Details

#list_to_string(list) ⇒ Object



13
14
15
16
17
# File 'lib/source/strategy/student_list_yaml.rb', line 13

def list_to_string(list)
  list.map {
    |h|
    h.transform_keys(&:to_s)}.to_yaml
end

#string_to_list(str) ⇒ Object



9
10
11
# File 'lib/source/strategy/student_list_yaml.rb', line 9

def string_to_list(str)
  YAML.safe_load(str).map {|h| h.transform_keys(&:to_sym)}
end