Hi group,
as I'm (kind of) browsing ObjectSpace I wonder if there's a way to
dynamically collect a list of the names of the standard objects and
global constants of Ruby (you know STDOUT, ARGV, DATA, RUBY_VERSION etc.)?
Is there a way to get these names? (And if so how would you suggest to
collect it?)
Do you mean this?
irb(main):001:0> Object.constants
=> ["TRUE", "SystemStackError", "RubyLex", "MatchData", "StandardError",
"ThreadError", "Float", "Tempfile", "SimpleDelegater", "RuntimeError",
"RUBY_RELEASE_DATE", "SimpleDelegator", "Continuation", "STDERR",
"Enumerable", "Object", "ObjectSpace", "NameError", "Errno", "Data",
"Process", "SignalException", "LoadError", "TOPLEVEL_BINDING", "Time",
"UnboundMethod", "Kernel", "IndexError", "NilClass", "STDIN",
"Comparable", "File", "Fixnum", "EOFError", "SystemCallError", "Dir",
"FloatDomainError", "ThreadGroup", "Class", "Precision", "ScriptError",
"RELEASE_DATE", "Symbol", "ARGV", "FalseClass", "Proc", "MatchingData",
"Readline", "GC", "TypeError", "String", "Thread", "SecurityError", "ENV",
"Binding", "NoMethodError", "RUBY_PLATFORM", "Delegator", "Regexp",
"Interrupt", "Integer", "SLex", "TrueClass", "NotImplementedError", "IO",
"Delegater", "Bignum", "Range", "RangeError", "STDOUT", "RUBY_VERSION",
"IRB", "RegexpError", "Numeric", "Hash", "Exception2MessageMapper",
"RubyToken", "Kconv", "SyntaxError", "Exception", "Signal", "PLATFORM",
"FALSE", "Array", "ArgumentError", "FileTest", "Struct",
"ZeroDivisionError", "NoMemoryError", "SystemExit", "IOError",
"LocalJumpError", "Math", "Marshal", "ARGF", "NIL", "Module", "Method",
"VERSION"]
Peter