Class: DCase::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/dcase/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Config

Returns a new instance of Config.



10
11
12
13
14
15
16
17
# File 'lib/dcase/config.rb', line 10

def initialize(args)
  @args = args || []

  parse_args
  read_config

  check_values
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



8
9
10
# File 'lib/dcase/config.rb', line 8

def args
  @args
end

#config_pathObject

Returns the value of attribute config_path.



8
9
10
# File 'lib/dcase/config.rb', line 8

def config_path
  @config_path
end

#passwordObject

Returns the value of attribute password.



8
9
10
# File 'lib/dcase/config.rb', line 8

def password
  @password
end

#portObject

Returns the value of attribute port.



8
9
10
# File 'lib/dcase/config.rb', line 8

def port
  @port
end

#serverObject

Returns the value of attribute server.



8
9
10
# File 'lib/dcase/config.rb', line 8

def server
  @server
end

#sideObject

Returns the value of attribute side.



8
9
10
# File 'lib/dcase/config.rb', line 8

def side
  @side
end

Instance Method Details

#check_valuesObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/dcase/config.rb', line 19

def check_values
  if side.nil?
    raise 'You need to define side of dcase in'
  end

  if side == 'local' && server.nil?
    raise 'You need to define remote server address'
  end

  if port.nil?
    raise 'You need to define remote server port'
  end

  if password.nil?
    raise 'You need to define a password, should be same in server/local side'
  end
end