class Umwelt::Abstract::File::Restore
Public Class Methods
new(path: '.umwelt', mapper: Struct)
click to toggle source
# File lib/umwelt/abstract/file/restore.rb, line 10 def initialize(path: '.umwelt', mapper: Struct) @path = path @mapper = mapper end
Private Instance Methods
parse(str)
click to toggle source
# File lib/umwelt/abstract/file/restore.rb, line 24 def parse(str) JSON.parse(str, symbolize_names: true) rescue JSON::ParserError error! "Failed JSON parsing #{self.class.name}" end
read(path)
click to toggle source
# File lib/umwelt/abstract/file/restore.rb, line 18 def read(path) path.read rescue Errno::ENOENT error! "Failed reading #{path}" end
struct(struct_hash)
click to toggle source
# File lib/umwelt/abstract/file/restore.rb, line 30 def struct(struct_hash) prove( @mapper.new.call(struct_hash) ).struct end
umwelt_root_path()
click to toggle source
# File lib/umwelt/abstract/file/restore.rb, line 36 def umwelt_root_path Pathname.pwd / @path end