Class: Ruby::Nginx::Commands::AddNginxConfig

Inherits:
Object
  • Object
show all
Includes:
Ruby::Nginx::Constants
Defined in:
lib/ruby/nginx/commands/add_nginx_config.rb

Constant Summary

Constants included from Ruby::Nginx::Constants

Ruby::Nginx::Constants::CONFIG_PATH, Ruby::Nginx::Constants::SERVERS_PATH

Instance Method Summary collapse

Constructor Details

#initialize(name, config) ⇒ AddNginxConfig

Returns a new instance of AddNginxConfig.



12
13
14
15
# File 'lib/ruby/nginx/commands/add_nginx_config.rb', line 12

def initialize(name, config)
  @name = name
  @config = config
end

Instance Method Details

#runObject



17
18
19
20
21
22
# File 'lib/ruby/nginx/commands/add_nginx_config.rb', line 17

def run
  return false unless changed?

  Ruby::Nginx::System::SafeFile.write(config_path, @config)
  true
end