Sha256: 67d0d00cfb24a12d2462a51664b8d796876ebbe34d529c35197c07cdce51c518

Contents?: true

Size: 585 Bytes

Versions: 4

Compression:

Stored size: 585 Bytes

Contents

module RailsDevtools
  module Routes
    class EngineInfo
      def initialize(engine_name)
        @engine_name = engine_name
      end

      def engine
        return Rails.application if @engine_name == "Application"

        @engine_name.constantize
      end

      def engine?
        @engine_name != "Application"
      end

      def name
        @engine_name
      end

      def path
        @path ||= engine.routes.find_script_name({})
      end

      def helper_prefix
        return "" unless engine?

        path.split("/").last.underscore
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rails_devtools-0.1.3 app/models/rails_devtools/routes/engine_info.rb
rails_devtools-0.1.2 app/models/rails_devtools/routes/engine_info.rb
rails_devtools-0.1.1 app/models/rails_devtools/routes/engine_info.rb
rails_devtools-0.1.0 app/models/rails_devtools/routes/engine_info.rb