Class: ClaudeHooks::FileChanged
- Inherits:
-
Base
- Object
- Base
- ClaudeHooks::FileChanged
show all
- Defined in:
- lib/claude_hooks/file_changed.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
Class Method Details
.hook_type ⇒ Object
7
8
9
|
# File 'lib/claude_hooks/file_changed.rb', line 7
def self.hook_type
'FileChanged'
end
|
11
12
13
|
# File 'lib/claude_hooks/file_changed.rb', line 11
def self.input_fields
%w[file_path event]
end
|
Instance Method Details
#created? ⇒ Boolean
24
25
26
|
# File 'lib/claude_hooks/file_changed.rb', line 24
def created?
event == 'add'
end
|
#deleted? ⇒ Boolean
32
33
34
|
# File 'lib/claude_hooks/file_changed.rb', line 32
def deleted?
event == 'unlink'
end
|
#event ⇒ Object
Values: change | add | unlink
20
21
22
|
# File 'lib/claude_hooks/file_changed.rb', line 20
def event
@input_data['event']
end
|
#file_path ⇒ Object
15
16
17
|
# File 'lib/claude_hooks/file_changed.rb', line 15
def file_path
@input_data['file_path'] || @input_data['filePath']
end
|
#modified? ⇒ Boolean
28
29
30
|
# File 'lib/claude_hooks/file_changed.rb', line 28
def modified?
event == 'change'
end
|
#watch_paths!(paths) ⇒ Object
36
37
38
39
|
# File 'lib/claude_hooks/file_changed.rb', line 36
def watch_paths!(paths)
@output_data['hookSpecificOutput'] ||= { 'hookEventName' => hook_event_name }
@output_data['hookSpecificOutput']['watchPaths'] = Array(paths)
end
|