📁 File Manager Pro
v10.0.3 | PHP: 8.1.34
Server: Apache
2026-06-21 22:14:01
📂
/ (Root)
/
opt
/
alt
/
ruby27
/
share
/
ri
/
system
/
Module
📍 /opt/alt/ruby27/share/ri/system/Module
🔄 Refresh
✏️
Editing: const_source_location-i.ri
Read Only
U:RDoc::AnyMethod[iI"const_source_location:ETI"!Module#const_source_location;TF:privateo:RDoc::Markup::Document:@parts[ o:RDoc::Markup::Paragraph; [ I"RReturns the Ruby source filename and line number containing first definition ;TI"Sof constant specified. If the named constant is not found, +nil+ is returned. ;TI"LIf the constant is found, but its source location can not be extracted ;TI">(constant is defined in C code), empty array is returned.;To:RDoc::Markup::BlankLine o; ; [I"Q_inherit_ specifies whether to lookup in <code>mod.ancestors</code> (+true+ ;TI"by default).;T@o:RDoc::Markup::Verbatim; [$I"# test.rb: ;TI" class A ;TI" C1 = 1 ;TI" end ;TI" ;TI"module M ;TI" C2 = 2 ;TI" end ;TI" ;TI"class B < A ;TI" include M ;TI" C3 = 3 ;TI" end ;TI" ;TI",class A # continuation of A definition ;TI" end ;TI" ;TI"Dp B.const_source_location('C3') # => ["test.rb", 11] ;TI"Cp B.const_source_location('C2') # => ["test.rb", 6] ;TI"Cp B.const_source_location('C1') # => ["test.rb", 2] ;TI" ;TI"Vp B.const_source_location('C2', false) # => nil -- don't lookup in ancestors ;TI" ;TI"Cp Object.const_source_location('B') # => ["test.rb", 9] ;TI"rp Object.const_source_location('A') # => ["test.rb", 1] -- note it is first entry, not "continuation" ;TI" ;TI"fp B.const_source_location('A') # => ["test.rb", 1] -- because Object is in ancestors ;TI"p M.const_source_location('A') # => ["test.rb", 1] -- Object is not ancestor, but additionally checked for modules ;TI" ;TI"\p Object.const_source_location('A::C1') # => ["test.rb", 2] -- nesting is supported ;TI"Xp Object.const_source_location('String') # => [] -- constant is defined in C code;T:@format0: @fileI" object.c;T:0@omit_headings_from_table_of_contents_below0I"�mod.const_source_location(sym, inherit=true) -> [String, Integer] mod.const_source_location(str, inherit=true) -> [String, Integer] ;T0[ I"(*args);T@7FI"Module;TcRDoc::NormalClass00
💾 Save Changes
❌ Cancel