Sha256: b28db4bd8bd4874575d60efc48b2f2872d8a2c61182eee1b5b02379c8e0739d4
Contents?: true
Size: 424 Bytes
Versions: 1
Compression:
Stored size: 424 Bytes
Contents
require 'mayu/stores/base' require 'json' module Mayu module Stores class File < Base def initialize(path:) @path = path end attr_reader :path def put(obj) ::File.write path, "#{for_json(obj).to_json}\n" end def get from_json JSON.parse(::File.read(path), symbolize_names: true) rescue Errno::ENOENT return nil end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mayu-0.1.0.beta1 | lib/mayu/stores/file.rb |