Module: Codebreaker::YamlFile
- Included in:
- Statistic
- Defined in:
- lib/codebreaker/yaml_file.rb
Class Method Summary collapse
Class Method Details
.load(file_path) ⇒ Object
4 5 6 7 8 |
# File 'lib/codebreaker/yaml_file.rb', line 4 def self.load(file_path) return unless File.exist?(file_path) YAML.safe_load(File.read(file_path), [Symbol], [], true) end |
.save(file_path, object) ⇒ Object
10 11 12 |
# File 'lib/codebreaker/yaml_file.rb', line 10 def self.save(file_path, object) File.open(file_path, 'w') { |file| file.write(object.to_yaml) } end |