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



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

def self.start_session_log
  timestamp = proc{ Time.now.strftime("%Y-%m-%d, %H:%M:%S")}
  class <<timestamp  # :nodoc: #
    alias 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
# File 'lib/reo_console.rb', line 25

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