Class: StudentListYaml

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

Instance Method Summary collapse

Instance Method Details

#list_to_str(hash_list) ⇒ Object



14
15
16
# File 'lib/source/repositories/data_sources/strategy/student_list_yaml.rb', line 14

def list_to_str(hash_list)
  hash_list.map { |h| h.transform_keys(&:to_s) }.to_yaml
end

#str_to_list(str) ⇒ Object



10
11
12
# File 'lib/source/repositories/data_sources/strategy/student_list_yaml.rb', line 10

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