Sha256: 9546c6eb144233a33311a5dc13f5e81351cc20aca195e71109d1bdf5309d2cd0

Contents?: true

Size: 846 Bytes

Versions: 19

Compression:

Stored size: 846 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'
require 'find'
require 'delegate'

module EacRailsBase0
  # A extended version of [Rails::Engine].
  class XEngine < SimpleDelegator
    class << self
      enable_simple_cache

      def local_root
        ::Rails.root.join('engines')
      end

      private

      def all_uncached
        ::Rails::Engine.subclasses.map { |engine_class| new(engine_class.instance) }
      end

      def local_uncached
        all.select(&:local?)
      end
    end

    def initialize(engine_instance)
      super(engine_instance)
    end

    def local?
      return false unless self.class.local_root.directory?

      ::Find.find(self.class.local_root.to_path).include?(config.root.to_path)
    end

    def namespace_module_name
      __getobj__.class.name.deconstantize
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
eac_rails_base0-0.57.0 lib/eac_rails_base0/x_engine.rb
eac_rails_base0-0.56.0 lib/eac_rails_base0/x_engine.rb
eac_rails_base0-0.55.3 lib/eac_rails_base0/x_engine.rb
eac_rails_base0-0.55.2 lib/eac_rails_base0/x_engine.rb
eac_rails_base0-0.55.1 lib/eac_rails_base0/x_engine.rb
eac_rails_base0-0.55.0 lib/eac_rails_base0/x_engine.rb
eac_rails_base0-0.54.0 lib/eac_rails_base0/x_engine.rb
eac_rails_base0-0.53.0 lib/eac_rails_base0/x_engine.rb
eac_rails_base0-0.52.3 lib/eac_rails_base0/x_engine.rb
eac_rails_base0-0.52.2 lib/eac_rails_base0/x_engine.rb
eac_rails_base0-0.52.1 lib/eac_rails_base0/x_engine.rb
eac_rails_base0-0.52.0 lib/eac_rails_base0/x_engine.rb
eac_rails_base0-0.51.0 lib/eac_rails_base0/x_engine.rb
eac_rails_base0-0.50.0 lib/eac_rails_base0/x_engine.rb
eac_rails_base0-0.49.0 lib/eac_rails_base0/x_engine.rb
eac_rails_base0-0.48.1 lib/eac_rails_base0/x_engine.rb
eac_rails_base0-0.48.0 lib/eac_rails_base0/x_engine.rb
eac_rails_base0-0.47.0 lib/eac_rails_base0/x_engine.rb
eac_rails_base0-0.46.0 lib/eac_rails_base0/x_engine.rb