Sha256: 9c9a961d8cfd8e2fffe8943c6348a42dfd81d98c0641e644f483691297d1a0b5
Contents?: true
Size: 475 Bytes
Versions: 2
Compression:
Stored size: 475 Bytes
Contents
# frozen_string_literal: true # Main Gem module module CodeBrkrGameTraining # Module for file operations module FileOperations def save_to_file(data, path) yml = YAML.dump(data) File.open(path, 'a') { |yml_file| yml_file.write(yml) } end def load_from_file(path) begin yml_data = File.open(path, &:read) rescue Errno::ENOENT yml_data = '' end YAML.load_stream( yml_data ) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
code_brkr_game_training-0.7.5 | lib/code_brkr_game_training/modules/file_operations.rb |
code_brkr_game_training-0.7.2 | lib/code_brkr_game_training/modules/file_operations.rb |