Actions
Bug #11711
closedDocumentation for ARGV behavior is incorrect
Description
http://ruby-doc.org/core-2.2.3/Object.html#ARGV
The above documentation states that ARGV[0] will contain the name of the Ruby program. While this is the behavior of ARGV in other places (C, Python, etc), it is not the behavior in Ruby.
In Ruby, ARGV[0] contains the name of the first argument supplied to the program's invocation.
To reproduce:
# argv-tester.rb
#!/usr/bin/env ruby
p ARGV[0]
Then execute with an argument:
$> ruby argv-tester.rb foo
foo
And without an argument:
$> ruby argv-tester.rb
nil
Updated by nobu (Nobuyoshi Nakada) almost 9 years ago
- Status changed from Open to Closed
Applied in changeset r52670.
ruby.c: fix ARGV doc [ci skip]
- ruby.c (ruby_prog_init): [DOC] ARGV does not contain the name of
the executable. [ruby-core:71561] [Bug #11711]
Actions
Like0
Like0