Module: Readline::Hist

Defined in:
lib/reo_console.rb

Overview

:nodoc:

Constant Summary collapse

LOG =
IRB.conf[:HISTORY_FILE]

Class Method Summary collapse

Class Method Details

.start_session_logObject



32
33
34
35
36
37
38
39
# File 'lib/reo_console.rb', line 32

def self.start_session_log
  timestamp = proc { Time.now.strftime('%Y-%m-%d, %H:%M:%S') }
  class <<timestamp # :nodoc:
    alias_method :to_s, :call
  end
  write_log("###### session start: #{timestamp}")
  at_exit { write_log("###### session stop:  #{timestamp}") }
end

.write_log(line) ⇒ Object

LOG = “#'HOME'/.irb-history”



25
26
27
28
29
30
# File 'lib/reo_console.rb', line 25

def self.write_log(line)
  File.open(LOG, 'ab') do |f|
    f << "#{line}
  "
  end
end