Class: History

Inherits:
Object
  • Object
show all
Defined in:
lib/captured/history.rb

Class Method Summary collapse

Class Method Details

.append(original_name, remote_path) ⇒ Object



13
14
15
16
17
# File 'lib/captured/history.rb', line 13

def self.append(original_name, remote_path)
  File.open(History.file_path, 'a') do |f|
    f.puts(History.format_line(original_name, remote_path))
  end
end

.file_pathObject



5
6
7
# File 'lib/captured/history.rb', line 5

def self.file_path
  "#{ENV['HOME']}/.captured_history"
end

.format_line(original_name, remote_path) ⇒ Object



19
20
21
# File 'lib/captured/history.rb', line 19

def self.format_line(original_name, remote_path)
  "#{History.time_stamp} \"#{original_name}\" #{remote_path}"
end

.listObject



23
24
25
26
27
28
29
30
31
# File 'lib/captured/history.rb', line 23

def self.list
  if File.exists? History.file_path
    File.open(History.file_path).each do |line|
      puts line
    end
  else
    puts "You ain't got no history yet"
  end
end

.time_stampObject



9
10
11
# File 'lib/captured/history.rb', line 9

def self.time_stamp
  DateTime.now.strftime("%m/%d/%Y-%I:%M%p")
end