Module: Kestrel::Config

Extended by:
Config
Included in:
Config
Defined in:
lib/kestrel/config.rb

Defined Under Namespace

Classes: ConfigNotLoaded

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missingObject



35
36
37
# File 'lib/kestrel/config.rb', line 35

def namespace(namespace)
  client_args_from config[namespace.to_s][environment.to_s]
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



9
10
11
# File 'lib/kestrel/config.rb', line 9

def config
  @config
end

#environmentObject

Returns the value of attribute environment.



9
10
11
# File 'lib/kestrel/config.rb', line 9

def environment
  @environment
end

Instance Method Details

#defaultObject



27
28
29
# File 'lib/kestrel/config.rb', line 27

def default
  client_args_from config[environment.to_s]
end

#load(config_file) ⇒ Object



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

def load(config_file)
  self.config = YAML.load_file(config_file)
end

#namespace(namespace) ⇒ Object Also known as: method_missing



23
24
25
# File 'lib/kestrel/config.rb', line 23

def namespace(namespace)
  client_args_from config[namespace.to_s][environment.to_s]
end

#new_client(space = nil) ⇒ Object



31
32
33
# File 'lib/kestrel/config.rb', line 31

def new_client(space = nil)
  Client.new *(space ? namespace(space) : default)
end