Class: AgentX::Console

Inherits:
Object
  • Object
show all
Defined in:
lib/agentx/console.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Console

Returns a new instance of Console.



6
7
8
# File 'lib/agentx/console.rb', line 6

def initialize(options={})
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/agentx/console.rb', line 4

def options
  @options
end

Class Method Details

.load(filename) ⇒ Object



25
26
27
# File 'lib/agentx/console.rb', line 25

def self.load(filename)
  class_eval(File.read(filename))
end

Instance Method Details

#load_configObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/agentx/console.rb', line 10

def load_config
  unless options[:config]
    options[:config] = "#{AgentX.root}/config"

    unless File.exists?(options[:config])
      example = 
        File.expand_path('../../config.example', File.dirname(__FILE__))
      FileUtils.cp(example, options[:config])
      FileUtils.chmod(0600, options[:config])
    end
  end

  self.class.load(options[:config])
end