Class: ClaudeHooks::SessionEnd

Inherits:
Base
  • Object
show all
Defined in:
lib/claude_hooks/session_end.rb

Constant Summary

Constants inherited from Base

Base::COMMON_INPUT_FIELDS

Instance Attribute Summary

Attributes inherited from Base

#config, #input_data, #logger, #output, #output_data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#agent_id, #agent_type, #allow_continue!, #base_dir, #call, #clear_specifics!, #clear_system_message!, #cwd, #effort, #home_claude_dir, #home_path_for, #hook_event_name, #hook_type, #initialize, #log, #output_and_exit, #path_for, #permission_mode, #prevent_continue!, #project_claude_dir, #project_path_for, #prompt_id, #read_transcript, #session_id, #show_output!, #stringify_output, #suppress_output!, #system_message!, #terminal_sequence, #terminal_sequence!, #transcript_path

Constructor Details

This class inherits a constructor from ClaudeHooks::Base

Class Method Details

.hook_typeObject



7
8
9
# File 'lib/claude_hooks/session_end.rb', line 7

def self.hook_type
  'SessionEnd'
end

.input_fieldsObject



11
12
13
# File 'lib/claude_hooks/session_end.rb', line 11

def self.input_fields
  %w[reason]
end

Instance Method Details

#cleared?Boolean

Check if session was cleared with /clear command

Returns:

  • (Boolean)


24
25
26
# File 'lib/claude_hooks/session_end.rb', line 24

def cleared?
  reason == 'clear'
end

#logout?Boolean

Check if user logged out

Returns:

  • (Boolean)


29
30
31
# File 'lib/claude_hooks/session_end.rb', line 29

def logout?
  reason == 'logout'
end

#other_reason?Boolean

Check if reason is unspecified or other

Returns:

  • (Boolean)


39
40
41
# File 'lib/claude_hooks/session_end.rb', line 39

def other_reason?
  !cleared? && !logout? && !prompt_input_exit?
end

#prompt_input_exit?Boolean

Check if user exited while prompt input was visible

Returns:

  • (Boolean)


34
35
36
# File 'lib/claude_hooks/session_end.rb', line 34

def prompt_input_exit?
  reason == 'prompt_input_exit'
end

#reasonObject

INPUT DATA ACCESS ===



17
18
19
# File 'lib/claude_hooks/session_end.rb', line 17

def reason
  @input_data['reason']
end