Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8481353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:32:25+00:00 2026-06-10T19:32:25+00:00

In Ruby 1.8.7, the documentation does not list ARGF under classes and modules, and

  • 0

In Ruby 1.8.7, the documentation does not list ARGF under classes and modules, and ARGF isn’t a class or a module:

ARGF.class # => Object

In Ruby 1.9.3, the documentation has ARGF under classes and modules, but I see this:

ARGF.class # => ARGF.class
ARGF.superclass # => NoMethodError: undefined method `superclass' for ARGF:ARGF.class
ARGF.class.superclass # => Object
  • Why does Ruby 1.9 documentation place ARGF as a class when the actual class is something else? Or are they the same thing?
  • Is ARGF.class a metaclass, a virtual class, singleton class, or something else?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T19:32:26+00:00Added an answer on June 10, 2026 at 7:32 pm

    ARGF is implemented in C and you can do weird things in it. The ARGF class is defined there first. It is not set to any constant in Ruby, but its name is set to “ARGF.class”.
    Then ARGF constant is set to an instance of that class.

    rb_cARGF = rb_class_new(rb_cObject);
    rb_set_class_path(rb_cARGF, rb_cObject, "ARGF.class");
    /* ... */
    argf = rb_class_new_instance(0, 0, rb_cARGF);
    rb_define_global_const("ARGF", argf);
    

    Here is a Ruby code that is doing roughly the same thing.

    argf_class = Class.new
    def argf_class.name
      "ARGF.class"
    end
    argf = argf_class.new
    ARGF = argf
    

    It does not look reasonable in Ruby, but in C it is fine. Although, I think the class could be set to ARGFClass like NilClass, TrueClass, FalseClass, so that it is not confusing.

    I don’t know the history of the change. I think Ruby core folks wanted to get ARGF into the docs and this was the simplest way. (RDoc can’t show documentation for singleton objects.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I installed ruby and ruby gems through macport but the gem list does not
Does anybody know some nice documentation about the ruby handsoap gem to get me
I'm pretty new to Ruby. I've tried looking over the online documentation, but I
rubydoc.org has the core documentation for Ruby 1.8.x and Ruby 1.9.1, and for the
My problem is ruby recognizes require 'packetfu' and include PacketFu in IRB but does
I have not found any documentation nor tutorial for that. Does anything like that
This question is similar to Why are methods in Ruby documentation preceded by a
Ruby 1.9.3 defaults to using Psych for YAML. While the ruby-doc documentation for it
Using Ruby, I'm trying to parse some documentation in which I need to split
I have followed Apple's documentation on localizing iPhone software, using the genstrings ruby script

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.