Sha256: 636967bce3863779d811e7bcd09d24437b52b36169c858ad457cb82d2d3756dd

Contents?: true

Size: 514 Bytes

Versions: 14

Compression:

Stored size: 514 Bytes

Contents

module Toy
  def models
    Toy::Store.direct_descendants
  end

  def plugins
    Toy::Store.plugins
  end

  def plugin(mod)
    Toy::Store.plugin(mod)
  end

  module Plugins
    include ActiveSupport::DescendantsTracker

    def plugins
      @plugins ||= []
    end

    def plugin(mod)
      include(mod)
      direct_descendants.each {|model| model.send(:include, mod) }
      plugins << mod
    end

    def included(base=nil, &block)
      direct_descendants << base if base
      super
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
toystore-0.12.0 lib/toy/plugins.rb
toystore-0.11.0 lib/toy/plugins.rb
toystore-0.10.4 lib/toy/plugins.rb
toystore-0.10.3 lib/toy/plugins.rb
toystore-0.10.2 lib/toy/plugins.rb
toystore-0.10.1 lib/toy/plugins.rb
toystore-0.10.0 lib/toy/plugins.rb
toystore-0.9.0 lib/toy/plugins.rb
toystore-0.8.3 lib/toy/plugins.rb
toystore-0.8.2 lib/toy/plugins.rb
toystore-0.8.1 lib/toy/plugins.rb
toystore-0.8.0 lib/toy/plugins.rb
toystore-0.7.0 lib/toy/plugins.rb
toystore-0.6.6 lib/toy/plugins.rb