Class: Redirus::Worker::AddProxy::Action

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/redirus/worker/add_proxy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#config, #config_file_path, #full_name

Constructor Details

#initialize(name, workers, type, location_props, options = {}) ⇒ Action

Returns a new instance of Action.



16
17
18
19
20
21
22
# File 'lib/redirus/worker/add_proxy.rb', line 16

def initialize(name, workers, type, location_props, options = {})
  @name = name
  @workers = workers
  @type = type
  @location_properties = location_properties(location_props) || []
  @options = options
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



24
25
26
# File 'lib/redirus/worker/add_proxy.rb', line 24

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



24
25
26
# File 'lib/redirus/worker/add_proxy.rb', line 24

def type
  @type
end

#workersObject (readonly)

Returns the value of attribute workers.



24
25
26
# File 'lib/redirus/worker/add_proxy.rb', line 24

def workers
  @workers
end

Instance Method Details

#executeObject



26
27
28
29
30
31
# File 'lib/redirus/worker/add_proxy.rb', line 26

def execute
  File.open(config_file_path(name, type), 'w') do |file|
    erb = ERB.new(template, nil, '-')
    file.write erb.result(binding)
  end
end