Module: Trashinfo
- Defined in:
- lib/trashinfo.rb
Class Method Summary collapse
Class Method Details
.new(path) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/trashinfo.rb', line 6 def self.new(path) <<~DESKTOP [Trash Info] Path=#{CGI.escape(File.(path))} DeletionDate=#{Time.now.strftime('%Y-%m-%dT%H:%M:%S')} DESKTOP end |
.parse(trashinfo) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/trashinfo.rb', line 14 def self.parse(trashinfo) regex = /\A\[Trash Info\]\nPath=(?<path>\S+)\nDeletionDate=(?<deletion_date>\S+)/m matches = regex.match trashinfo { path: CGI.unescape(matches[:path]), deletion_date: matches[:deletion_date] } end |