Class: Ask::Rails::Harness::Tools::ReadFile

Inherits:
Ask::Rails::Harness::Tool show all
Defined in:
lib/ask/rails/harness/tools/read_file.rb

Instance Method Summary collapse

Methods inherited from Ask::Rails::Harness::Tool

#call, #rails_root, session_id, session_id=

Instance Method Details

#execute(path:) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/ask/rails/harness/tools/read_file.rb', line 12

def execute(path:)
  full_path = rails_root.join(path)
  return Ask::Result.error(message: "File not found: #{path}") unless full_path.exist?

  content = full_path.read
  { path: path, content: content, size: content.length }
end