Module: Disk
- Defined in:
- lib/fantasy/disk.rb
Class Method Summary collapse
Class Method Details
.data ⇒ Object
11 12 13 |
# File 'lib/fantasy/disk.rb', line 11 def self.data @@data ||= OpenStruct.new(load) end |
.save ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/fantasy/disk.rb', line 15 def self.save dirname = File.dirname(@@data_path) unless File.directory?(dirname) FileUtils.mkdir_p(dirname) end File.open(@@data_path, "w") { |f| f.write JSON.pretty_generate(@@data.to_h) } end |