Project

General

Profile

ActionsLike0

Bug #11711

closed

Documentation for ARGV behavior is incorrect

Added by trevrosen (Trevor Rosen) almost 10 years ago. Updated almost 10 years ago.

Status:
Closed
Target version:
-
[ruby-core:71561]

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
Like0Actions #1

Updated by nobu (Nobuyoshi Nakada) almost 10 years ago

  • Status changed from Open to Closed

Applied in changeset r52670.


ruby.c: fix ARGV doc [ci skip]

ActionsLike0

Also available in: Atom PDF