Sha256: 5381cc53555e0a770831cae613955e24729f7b89cb105917875220cf8fd288a7
Contents?: true
Size: 850 Bytes
Versions: 1
Compression:
Stored size: 850 Bytes
Contents
require 'toml' module ErrandBoy class Request attr_reader :sender, :provider, :action, :register, :destination, :path def self.dir File.expand_path 'requests' end def initialize(path) @path = path.to_s request.each do |key, value| instance_variable_set("@#{key}", value) end @sender = '' unless instance_variable_defined? :@sender end def rename timestamp = Time.now.strftime '%y%m%d%H%M%S' index = path.index('.toml') File.rename path, path.dup.insert(index, "_#{timestamp}") end def delete File.delete path end private def request TOML.load_file(path) rescue Errno::ENOENT raise NoRequestError, 'No such request file in this commit. ' \ 'You should add a request file to `requests/` folder.' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
errand-boy-0.1.0 | lib/errand_boy/request.rb |