From 704d362a1224a403ea2a468dde311c54b280a379 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Sun, 3 May 2026 15:51:32 +0900 Subject: [PATCH] Remove useless condition in example ## Motivation and Context The example files `examples/http_client.rb` and `examples/streamable_http_client.rb` are intended to be run as standalone scripts and are not designed to be reused as modules (e.g., via `require`). The `if __FILE__ == $PROGRAM_NAME` guard therefore serves no purpose and is removed. ## How Has This Been Tested? Manually verified that each example script can still be executed directly (`ruby examples/http_client.rb`, `ruby examples/streamable_http_client.rb`). No automated tests cover files under `examples/`. ## Breaking Changes None. The files under `examples/` are standalone scripts and are not part of the gem's public API. --- examples/http_client.rb | 5 +++-- examples/streamable_http_client.rb | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/http_client.rb b/examples/http_client.rb index 3efbff9b..4ef95c75 100644 --- a/examples/http_client.rb +++ b/examples/http_client.rb @@ -137,8 +137,7 @@ def close_session end end -# Main script -if __FILE__ == $PROGRAM_NAME +def main puts <<~MESSAGE MCP HTTP Client Example Make sure the HTTP server is running (ruby examples/http_server.rb) @@ -182,3 +181,5 @@ def close_session client.close_session end end + +main diff --git a/examples/streamable_http_client.rb b/examples/streamable_http_client.rb index 7cca9ac1..79e3f384 100644 --- a/examples/streamable_http_client.rb +++ b/examples/streamable_http_client.rb @@ -176,4 +176,4 @@ def main end end -main if __FILE__ == $PROGRAM_NAME +main