Class: Chronicle::Shell::ShellHistoryExtractor

Inherits:
ETL::Extractor
  • Object
show all
Defined in:
lib/chronicle/shell/shell_history_extractor.rb

Constant Summary collapse

BASH_TIMESTAMP_REGEX =
/^\#(?<timestamp>[0-9]{10})/

Instance Method Summary collapse

Instance Method Details

#extractObject



26
27
28
29
30
31
32
33
34
35
# File 'lib/chronicle/shell/shell_history_extractor.rb', line 26

def extract
  @commands.each do |command|
    meta = {
      username:,
      hostname:,
      shell_name: @config.shell
    }
    yield build_extraction(data: command, meta:)
  end
end

#prepareObject



18
19
20
# File 'lib/chronicle/shell/shell_history_extractor.rb', line 18

def prepare
  @commands = load_commands
end

#results_countObject



22
23
24
# File 'lib/chronicle/shell/shell_history_extractor.rb', line 22

def results_count
  @commands.count
end