class Nib::Integrate::IntegrationFile

dynamically generated network config file

Attributes

app_name[R]
current_port[R]

Public Class Methods

new(app_name, port = 10_000) click to toggle source
# File lib/nib/integrate/integration_file.rb, line 19
def initialize(app_name, port = 10_000)
  @current_port = port
  @app_name = app_name
end
write(app_name, port = 10_000) click to toggle source
# File lib/nib/integrate/integration_file.rb, line 8
def write(app_name, port = 10_000)
  new(app_name, port).write
end
write_empty_config(app_name, port = 10_000) click to toggle source
# File lib/nib/integrate/integration_file.rb, line 12
def write_empty_config(app_name, port = 10_000)
  new(app_name, port).write_empty_config
end

Public Instance Methods

write() click to toggle source
# File lib/nib/integrate/integration_file.rb, line 24
def write
  config.tap do |cfg|
    File.open(cfg.path, 'w') do |f|
      f.write(cfg.config.to_yaml)
    end
  end
end
write_empty_config() click to toggle source
# File lib/nib/integrate/integration_file.rb, line 32
def write_empty_config
  empty_config.tap do |cfg|
    File.open(cfg.path, 'w') do |f|
      f.write(cfg.config.to_yaml)
    end
  end
end

Private Instance Methods

config() click to toggle source
# File lib/nib/integrate/integration_file.rb, line 42
def config
  integration_file_config.config
end
empty_config() click to toggle source
# File lib/nib/integrate/integration_file.rb, line 46
def empty_config
  integration_file_config.empty_config
end
integration_file_config() click to toggle source
# File lib/nib/integrate/integration_file.rb, line 50
def integration_file_config
  IntegrationFileConfig.new(app_name, current_port)
end