Sha256: 42b0bdab0301591b5795b95f535e18bbaea97360cc6a1c82249040427d51c229
Contents?: true
Size: 526 Bytes
Versions: 2
Compression:
Stored size: 526 Bytes
Contents
module Spanx module Helper module Subclassing def self.included(base) base.extend ClassMethods end module ClassMethods def subclasses @@subclasses ||= {} end def subclass_name name.split("::").last.downcase end def subclass_class(subclass) subclasses[subclass] end private def inherited(subclass) subclasses[subclass.subclass_name] = subclass end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spanx-0.1.1 | lib/spanx/helper/subclassing.rb |
spanx-0.1.0 | lib/spanx/helper/subclassing.rb |