Sha256: 1cb8e6ea520709aae8e143ca175bc7939bd441b890fe533609991ed09cd549ab
Contents?: true
Size: 523 Bytes
Versions: 1
Compression:
Stored size: 523 Bytes
Contents
require 'json' module Annoyme class NotesFile def initialize(path) @path = path end def create File.open(@path, 'w') do |f| f.write("[]") end end def exists? File.exist?(@path) end def parse content = File.readlines(@path).first JSON.parse(content) rescue JSON::ParserError raise 'notes file seems to be corrupted' end def write(content) File.open(@path, 'w') do |f| f.write(content) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
annoyme-1.0.0 | lib/annoyme/notes_file.rb |