Skip to content

Commit 704d362

Browse files
committed
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.
1 parent 541200f commit 704d362

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

examples/http_client.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ def close_session
137137
end
138138
end
139139

140-
# Main script
141-
if __FILE__ == $PROGRAM_NAME
140+
def main
142141
puts <<~MESSAGE
143142
MCP HTTP Client Example
144143
Make sure the HTTP server is running (ruby examples/http_server.rb)
@@ -182,3 +181,5 @@ def close_session
182181
client.close_session
183182
end
184183
end
184+
185+
main

examples/streamable_http_client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,4 @@ def main
176176
end
177177
end
178178

179-
main if __FILE__ == $PROGRAM_NAME
179+
main

0 commit comments

Comments
 (0)