Sha256: 4876f2dfa0c9f50da4ba3f2cbb3a440a8c10c27d7710c433709fdc7fc30aee12
Contents?: true
Size: 954 Bytes
Versions: 7
Compression:
Stored size: 954 Bytes
Contents
module Netzke module Core module Inheritance extend ActiveSupport::Concern module ClassMethods attr_accessor :called_from # Ancestor classes in the Netzke class hierarchy up to (and excluding) +Netzke::Base+, including self; in comparison to Ruby's own Class.ancestors, the order is reversed. def netzke_ancestors if self == Netzke::Base [] else superclass.netzke_ancestors + [self] end end # Keep track of component's file. Inspired by Rails railties code. def inherited(base) base.called_from = begin cllr = if Kernel.respond_to?(:caller_locations) location = caller_locations.first location.absolute_path || location.path else caller.first.sub(/:\d+.*/, '') end cllr[0..-4] end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems