So this is something I’ve looked into many times over the years and have never found an answer to. But great news is that I’ve found a way! It’s as simple as defining module methods as private within the singleton class. Here’s how I did it in my gem PolyBelongsTo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
module PolyBelongsTo::Core extend ActiveSupport::Concern included do def self._pbt_polymorphic_orphans # some code here end def self._pbt_nonpolymorphic_orphans # some code here end class << self private :_pbt_polymorphic_orphans private :_pbt_nonpolymorphic_orphans end end end |
My gem gets included…
Continue Reading »