Sha256: b9a6d0c6302bb66db753bb3fbec65797b1ee0fbc4d1e5f35ef810465420b1a3d

Contents?: true

Size: 358 Bytes

Versions: 7

Compression:

Stored size: 358 Bytes

Contents

module Toy
  def models
    @models ||= Set.new
  end

  def plugins
    @plugins ||= Set.new
  end

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

  module Plugins
    extend ActiveSupport::Concern

    included do
      Toy.models << self
      Toy.plugins.each { |mod| include mod }
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
toystore-0.6.5 lib/toy/plugins.rb
toystore-0.6.4 lib/toy/plugins.rb
toystore-0.6.3 lib/toy/plugins.rb
toystore-0.6.2 lib/toy/plugins.rb
toystore-0.6.1 lib/toy/plugins.rb
toystore-0.6 lib/toy/plugins.rb
toystore-0.5 lib/toy/plugins.rb