Module: Rails::Command::EnvironmentArgument

Extended by:
ActiveSupport::Concern
Included in:
ConsoleCommand, CredentialsCommand, DbconsoleCommand, InitializersCommand, RunnerCommand, ServerCommand
Defined in:
railties/lib/rails/command/environment_argument.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods included from ActiveSupport::Concern

append_features, class_methods, extended, included, prepend_features, prepended

Instance Method Details

#initializeObject



16
17
18
19
20
21
22
23
24
25
26
# File 'railties/lib/rails/command/environment_argument.rb', line 16

def initialize(...)
  super

  @environment_specified = options[:environment].present?

  if !@environment_specified
    self.options = options.merge(environment: Rails::Command.environment)
  elsif !available_environments.include?(options[:environment])
    self.options = options.merge(environment: expand_environment_name(options[:environment]))
  end
end