Class: Fuguta::Configuration::DSLProxy

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

Instance Method Summary collapse

Constructor Details

#initialize(subject) ⇒ DSLProxy

Returns a new instance of DSLProxy.



104
105
106
107
108
# File 'lib/fuguta.rb', line 104

def initialize(subject)
  @subject = subject
  @config = subject.config
  @loading_path = nil
end

Instance Method Details

#configObject



110
111
112
# File 'lib/fuguta.rb', line 110

def config
  self
end

#load(*paths) ⇒ Object

Load separate configuration files from the file.

Load relative path file.


load 'test2.conf'

Load absolute path file.


load '/etc/test2.conf'


123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/fuguta.rb', line 123

def load(*paths)
  l = Loader.new(@subject)
  paths.each { |path|
    if path =~ %r{^/}
      # Load absolute path
      l.load(path)
    else
      # Load relative path
      base_conf_dir = (@loading_path.nil? ? Dir.pwd : File.dirname(@loading_path))
      l.load(File.expand_path(path, base_conf_dir))
    end
  }

  self
end