Class: DCase::Config
- Inherits:
-
Object
- Object
- DCase::Config
- Defined in:
- lib/dcase/config.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#config_path ⇒ Object
Returns the value of attribute config_path.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port ⇒ Object
Returns the value of attribute port.
-
#server ⇒ Object
Returns the value of attribute server.
-
#side ⇒ Object
Returns the value of attribute side.
Instance Method Summary collapse
- #check_values ⇒ Object
-
#initialize(args) ⇒ Config
constructor
A new instance of Config.
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
#args ⇒ Object
Returns the value of attribute args.
8 9 10 |
# File 'lib/dcase/config.rb', line 8 def args @args end |
#config_path ⇒ Object
Returns the value of attribute config_path.
8 9 10 |
# File 'lib/dcase/config.rb', line 8 def config_path @config_path end |
#password ⇒ Object
Returns the value of attribute password.
8 9 10 |
# File 'lib/dcase/config.rb', line 8 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
8 9 10 |
# File 'lib/dcase/config.rb', line 8 def port @port end |
#server ⇒ Object
Returns the value of attribute server.
8 9 10 |
# File 'lib/dcase/config.rb', line 8 def server @server end |
#side ⇒ Object
Returns the value of attribute side.
8 9 10 |
# File 'lib/dcase/config.rb', line 8 def side @side end |
Instance Method Details
#check_values ⇒ Object
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 |