Project

General

Profile

Actions

Bug #11711

closed

Documentation for ARGV behavior is incorrect

Added by trevrosen (Trevor Rosen) over 8 years ago. Updated over 8 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
Actions #1

Updated by nobu (Nobuyoshi Nakada) over 8 years ago

  • Status changed from Open to Closed

Applied in changeset r52670.


ruby.c: fix ARGV doc [ci skip]

Actions

Also available in: Atom PDF

Like0
Like0