aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/engine/railties.rb
blob: 033d9c41801057f3e5db2ddfdcd10c3b570e4b02 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module Rails
  class Engine < Railtie
    class Railties
      # TODO Write tests for this behavior extracted from Application
      def initialize(config)
        @config = config
      end

      def all(&block)
        @all ||= []
        @all.each(&block) if block
        @all
      end

      def self.railties
        @railties ||= ::Rails::Railtie.subclasses.map(&:instance)
      end

      def self.engines
        @engines ||= ::Rails::Engine.subclasses.map(&:instance)
      end

      delegate :railties, :engines, :to => "self.class"
    end
  end
end