Sha256: a53799a8a79113fcef2627b409f1afbe44402c0a283fb1dc5d8e719f7152f52c

Contents?: true

Size: 860 Bytes

Versions: 2

Compression:

Stored size: 860 Bytes

Contents

module Lotus
  module Commands
    # Display application/container routes.
    #
    # It is run with:
    #
    #   `bundle exec lotus routes`
    #
    # @since 0.1.0
    # @api private
    class Routes
      # @param options [Hash] Environment's options
      #
      # @since 0.1.0
      # @see Lotus::Environment#initialize
      def initialize(options)
        @environment = Lotus::Environment.new(options)
        @environment.require_application_environment
      end

      # Display to STDOUT application routes
      #
      # @since 0.1.0
      def start
        puts app.routes.inspector.to_s
      end

      private

      # @since 0.1.0
      # @api private
      def app
        if @environment.container?
          Lotus::Container.new
        else
          Lotus::Application.applications.first.new
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lotusrb-0.6.1 lib/lotus/commands/routes.rb
lotusrb-0.6.0 lib/lotus/commands/routes.rb