Module: Coral::Mixin::SubConfig

Included in:
Config::Project, Coral::Machine::Fog
Defined in:
lib/coral_core/mixin/sub_config.rb

Instance Method Summary collapse

Instance Method Details

#clearObject




136
137
138
139
140
# File 'lib/coral_core/mixin/sub_config.rb', line 136

def clear
  init_subconfig
  config.clear
  return self
end

#configObject




40
41
42
# File 'lib/coral_core/mixin/sub_config.rb', line 40

def config
  return @config
end

#config=(config) ⇒ Object




46
47
48
# File 'lib/coral_core/mixin/sub_config.rb', line 46

def config=config
  @config = config
end

#defaults(defaults, options = {}) ⇒ Object




168
169
170
171
172
# File 'lib/coral_core/mixin/sub_config.rb', line 168

def defaults(defaults, options = {})
  init_subconfig
  config.defaults(defaults, options)
  return self
end

#delete(keys, default = nil) ⇒ Object




120
121
122
123
124
# File 'lib/coral_core/mixin/sub_config.rb', line 120

def delete(keys, default = nil)
  init_subconfig
  config.delete(keys, default)
  return self
end

#directoryObject




52
53
54
55
56
57
58
59
60
# File 'lib/coral_core/mixin/sub_config.rb', line 52

def directory
  init_subconfig
  
  if config.is_a?(Config::Project)
    return config.project.directory
  else
    return nil
  end
end

#directory=(directory) ⇒ Object




64
65
66
67
68
69
70
# File 'lib/coral_core/mixin/sub_config.rb', line 64

def directory=directory
  init_subconfig
  
  if config.is_a?(Config::Project)
    config.set_location(directory)
  end
end

#exportObject




183
184
185
186
# File 'lib/coral_core/mixin/sub_config.rb', line 183

def export
  init_subconfig
  return config.export
end

#get(keys, default = nil, format = false) ⇒ Object




81
82
83
84
# File 'lib/coral_core/mixin/sub_config.rb', line 81

def get(keys, default = nil, format = false)
  init_subconfig
  return config.get(keys, default, format)
end

#import(properties, options = {}) ⇒ Object




152
153
154
155
156
# File 'lib/coral_core/mixin/sub_config.rb', line 152

def import(properties, options = {})
  init_subconfig
  config.import(properties, options)
  return self
end

#load(options = {}) ⇒ Object


Configuration loading saving



191
192
193
194
195
196
# File 'lib/coral_core/mixin/sub_config.rb', line 191

def load(options = {})
  if config.respond_to?(:load)
    config.load(options)
  end
  return self  
end

#nameObject


Propety accessors / modifiers



28
29
30
# File 'lib/coral_core/mixin/sub_config.rb', line 28

def name
  return _get(:name)
end

#name=(name) ⇒ Object




34
35
36
# File 'lib/coral_core/mixin/sub_config.rb', line 34

def name=name
  _set(:name, string(name))
end

#save(options = {}) ⇒ Object




200
201
202
203
204
205
# File 'lib/coral_core/mixin/sub_config.rb', line 200

def save(options = {})
  if config.respond_to?(:save)
    config.save(options)
  end
  return self  
end

#set(keys, value = '') ⇒ Object




103
104
105
106
107
# File 'lib/coral_core/mixin/sub_config.rb', line 103

def set(keys, value = '')
  init_subconfig
  config.set(keys, value)
  return self
end