Method: Arrow::Object.inherited
- Defined in:
- lib/arrow/object.rb
.inherited(klass) ⇒ Object
Store the name of the file from which the inheriting klass is being loaded.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/arrow/object.rb', line 100 def self::inherited( klass ) unless klass.instance_variables.include?( "@sourcefile" ) sourcefile = caller(1).find {|frame| /inherited/ !~ frame }.sub( /^([^:]+):.*/, "\\1" ) klass.instance_variable_set( "@sourcefile", sourcefile ) end unless klass.respond_to?( :sourcefile ) class << klass attr_reader :sourcefile end end end |