Sha256: 7d357703acfe47f72c7ad0acab4439c9be4422feacddcdda774dd9040c3d007f

Contents?: true

Size: 369 Bytes

Versions: 2

Compression:

Stored size: 369 Bytes

Contents

# frozen_string_literal: true
require_relative 'student_list_strat'
require 'yaml'

class StudentListYaml<StudentListStrategy
  public_class_method :new


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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shanti555890-1.1.5 lib/source/strategy/student_list_yaml.rb
shanti555890-1.1.4 lib/source/strategy/student_list_yaml.rb