Class: Conjure::Config
- Inherits:
-
Object
show all
- Defined in:
- lib/conjure/config.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options) ⇒ Config
Returns a new instance of Config.
11
12
13
|
# File 'lib/conjure/config.rb', line 11
def initialize(options)
@options = options
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object
15
16
17
18
|
# File 'lib/conjure/config.rb', line 15
def method_missing(name)
return @options[name.to_s] if @options.has_key? name.to_s
super
end
|
Class Method Details
.load(root_path) ⇒ Object
3
4
5
6
7
8
9
|
# File 'lib/conjure/config.rb', line 3
def self.load(root_path)
require "ostruct"
config_path = File.join root_path, "config", "conjure.yml"
data = YAML.load_file config_path
data["config_path"] = File.dirname config_path
new data
end
|
Instance Method Details
#file_contents(name) ⇒ Object
20
21
22
23
|
# File 'lib/conjure/config.rb', line 20
def file_contents(name)
name = @options[name.to_s] if name.is_a? Symbol
File.open File.join(@options["config_path"], name), "rb", &:read
end
|