Module: DeepdetectRuby::Configuration

Included in:
DeepdetectRuby
Defined in:
lib/configuration.rb

Constant Summary collapse

VALID_CONFIG_KEYS =
[:host, :host_train, :deepdetect_path, :model_path, :debug, :servers, :is_scaling].freeze
DEFAULT_HOST =
"http://127.0.0.1:8080"
DEFAULT_HOST_TRAIN =
"http://127.0.0.1:8080"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



11
12
13
# File 'lib/configuration.rb', line 11

def self.extended(base)
  base.reset
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



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

def configure
  yield self
end

#optionsObject



29
30
31
# File 'lib/configuration.rb', line 29

def options
  Hash[* VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten]
end

#resetObject



15
16
17
18
19
20
21
22
23
# File 'lib/configuration.rb', line 15

def reset
  self.host = DEFAULT_HOST
  self.host_train = DEFAULT_HOST_TRAIN
  self.deepdetect_path = ""
  self.model_path = ""
  self.debug = true
  self.servers = DEFAULT_HOST
  self.is_scaling = false
end