Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's a top-level constant. You can access it through another module, but it doesn't actually live there. <code>Class::RbConfig</code>, <code>Fixnum::RbConfig</code>, etc, all work, but the constant itself only lives at the top level.</p> <p>You can find it in <code>Object.constants</code>. <code>Object::RbConfig</code> is the only fully-qualified way of referencing it that doesn't result in a 'toplevel constant referenced by Module::' warning.</p> <p><strong>EDIT:</strong> Normally, inherited constants <em>do</em> show up in the value of <code>.constants</code>, but the ones from <code>Object</code> seem to be excluded:</p> <pre><code>irb(main):001:0&gt; Object.constants =&gt; [:Object, :Module, :Class, :BasicObject, :Kernel, :NilClass, :NIL, :Data, :TrueClass, :TRUE, :FalseClass, :FALSE, :Encoding, :Comparable, :Enumerable, :String, :Symbol, :Exception, :SystemExit, :SignalException, :Interrupt, :StandardError, :TypeError, :ArgumentError, :IndexError, :KeyError, :RangeError, :ScriptError, :SyntaxError, :LoadError, :NotImplementedError, :NameError, :NoMethodError, :RuntimeError, :SecurityError, :NoMemoryError, :EncodingError, :SystemCallError, :Errno, :ZeroDivisionError, :FloatDomainError, :Numeric, :Integer, :Fixnum, :Float, :Bignum, :Array, :Hash, :ENV, :Struct, :RegexpError, :Regexp, :MatchData, :Marshal, :Range, :IOError, :EOFError, :IO, :STDIN, :STDOUT, :STDERR, :ARGF, :FileTest, :File, :Dir, :Time, :Random, :Signal, :Process, :Proc, :LocalJumpError, :SystemStackError, :Method, :UnboundMethod, :Binding, :Math, :GC, :ObjectSpace, :Enumerator, :StopIteration, :RubyVM, :Thread, :TOPLEVEL_BINDING, :ThreadGroup, :Mutex, :ThreadError, :Fiber, :FiberError, :Rational, :Complex, :RUBY_VERSION, :RUBY_RELEASE_DATE, :RUBY_PLATFORM, :RUBY_PATCHLEVEL, :RUBY_REVISION, :RUBY_DESCRIPTION, :RUBY_COPYRIGHT, :RUBY_ENGINE, :ARGV, :Gem, :RbConfig, :Config, :CROSS_COMPILING, :Exception2MessageMapper, :IRB, :RubyToken, :RubyLex, :Readline, :Date] irb(main):002:0&gt; class Parent &lt; Object; Answer = 42; end =&gt; 42 irb(main):003:0&gt; class Child &lt; Parent; end =&gt; nil irb(main):004:0&gt; Child.constants =&gt; [:Answer] </code></pre> <p>You may wish to read <a href="http://cirw.in/blog/constant-lookup.html" rel="nofollow">this article</a> about constant lookups in Ruby. This passage seems relevant:</p> <blockquote> <p>Ruby assumes that you will mix modules into something that inherits from Object. So if the currently open module is a module, it will also add Object.ancestors to the lookup chain so that top-level constants work as expected.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload