summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-29 03:09:34 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-29 03:09:34 +0000
commit926301969f7970b5a59a065dabb234cddc590e6c (patch)
tree1962225c402f5ed2c75ed14b1eece1dd665fd0b4 /ruby.c
parent54bbc098fa1e05570e960750bf2c86d45017e575 (diff)
* math.c: Attach documentation for Math.
* object.c: Document NIL, TRUE, FALSE. * io.c: Improve grammar in ARGF comment. Document STDIN/OUT/ERR. Document ARGF global constant. * lib/rake: Hide deprecated toplevel constants from RDoc (import from rake trunk). * lib/thwait.rb: Document ThWait. * lib/mathn.rb: Hide Math redefinition from RDoc * lib/sync.rb: Add a basic comment for Sync_m, Synchronizer_m, Sync, Synchronizer. * parse.y: Document SCRIPT_LINES__. * hash.c: Document ENV class and global constant. * vm.c: Document TOPLEVEL_BINDING. * version.c: Document RUBY_* constants. * ruby.c: Document DATA and ARGV. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/ruby.c b/ruby.c
index f831b651c7..cb27d163a5 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1625,6 +1625,18 @@ load_file_internal(VALUE arg)
tree = rb_parser_compile_file(parser, fname, f, line_start);
rb_funcall(f, set_encoding, 1, rb_parser_encoding(parser));
if (script && tree && rb_parser_end_seen_p(parser)) {
+ /*
+ * DATA is a File that contains the data section of the executed file.
+ * To create a data section use <tt>__END__</tt>:
+ *
+ * $ cat t.rb
+ * puts DATA.gets
+ * __END__
+ * hello world!
+ *
+ * $ ruby t.rb
+ * hello world!
+ */
rb_define_global_const("DATA", f);
}
else if (f != rb_stdin) {
@@ -1746,6 +1758,13 @@ ruby_prog_init(void)
rb_define_hooked_variable("$0", &rb_progname, 0, set_arg0);
rb_define_hooked_variable("$PROGRAM_NAME", &rb_progname, 0, set_arg0);
+ /*
+ * ARGV contains the command line arguments used to run ruby with the
+ * first value containing the name of the executable.
+ *
+ * A library like OptionParser can be used to process command-line
+ * arguments.
+ */
rb_define_global_const("ARGV", rb_argv);
}