Class: Monster::Remote::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/monster/remote/configuration.rb

Instance Method Summary collapse

Constructor Details

#initialize(configuration_file = "_config.yml") ⇒ Configuration

Returns a new instance of Configuration.



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/monster/remote/configuration.rb', line 8

def initialize(configuration_file = "_config.yml")
  unless File.exists?(configuration_file)
    configuration_file = ".monster.yml"
  end

  @configs = {}

  begin
    file_info = YAML::load( File.open(configuration_file) )
    @configs = file_info && file_info["monster"] && file_info["monster"]["remote"]
  rescue Errno::ENOENT => e
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object (private)



39
40
41
42
43
44
# File 'lib/monster/remote/configuration.rb', line 39

def method_missing(method, *args)
  if expected.include? method
    return read_config(method.to_s)
  end
  super
end

Instance Method Details

#password_required?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/monster/remote/configuration.rb', line 22

def password_required?
  read_config("pass")
end

#verbose?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/monster/remote/configuration.rb', line 26

def verbose?
  read_config("verbose")
end